#4293: 請大大幫忙一下嚕


philosopher31 (Lady WaWa)


#include<iostream>
using namespace std;

int main()
{
   int a,b,c;
   while(cin>>a >>b >>c )
   {
      if(a>b&&a>c)
      cout<<a<<endl;
      if(b>a&&b>c)
      cout<<b<<endl;
      if(c>a&&c>b)
      cout<<c<<endl;
   }
  


   //system("pause");
   return 0;
}

請問哪裡出錯了??請大大幫忙修改一下

#4294: Re:請大大幫忙一下嚕


leopan0922 (zz)


#include
using namespace std;

int main()
{
   int a,b,c;
   while(cin>>a >>b >>c )
   {
      if(a>b&&a>c)
      cout<<
      if(b>a&&b>c)
      cout<<
      if(c>a&&c>b)
      cout<<
   }
  


   //system("pause");
   return 0;
}

請問哪裡出錯了??請大大幫忙修改一下

萬一a=b=c你會輸出啥?
#4299: Re:請大大幫忙一下嚕


asas (向諸神與地雷醬獻上祈禱)


你錯的地方樓上已經說過嚕~~ 

你可以用 max 這個內建涵式.....

用法是:

max( a , b ) ;

以上它會回傳 a 和 b 之中最大的數值.....回傳型態會根據你傳入的型態一樣 

以下是我的寫法....

#include<iostream>
using namespace std;

int main()
{
   int a,b,c;
   while(cin>>a >>b >>c )
   {
      cout<<max( a , max( b , c ) ) <<endl;
   }
}