#include<iostream>
using namespace std;
float maxp[3]={0},profit=1;
char s[]={'W','T','L'};
float max(float a,float b,float c)
{
if ((a>=b) && (a>=c))
{cout<<s[0]<<" ";return a;}
else if (b>=c)
{cout<<s[1]<<" ";return b;}
else
{cout<<s[2]<<" ";return c;} ;
}
int main()
{
float w,t,l;
for(int i=0;i<3;i++)
{
cin>>w>>t>>l;
maxp[i]=max(w,t,l);
profit*=maxp[i];
}
profit=2*(profit*0.65-1);
printf("%.2f",profit);
system("pause");
return 0;
using namespace std;
float maxp[3]={0},profit=1;
char s[]={'W','T','L'};
float max(float a,float b,float c)
{
if ((a>=b) && (a>=c))
{cout<<s[0]<<" ";return a;}
else if (b>=c)
{cout<<s[1]<<" ";return b;}
else
{cout<<s[2]<<" ";return c;} ;
}
int main()
{
float w,t,l;
for(int i=0;i<3;i++)
{
cin>>w>>t>>l;
maxp[i]=max(w,t,l);
profit*=maxp[i];
}
profit=2*(profit*0.65-1);
printf("%.2f",profit);
system("pause");
return 0;
}
1.if和else if 行后不能加;
2.PAT的答案37.98不对,实际为37.97
3.char s[]={'W','T','L'}使用会比较方便
4.保留两位小数Printf("%.2f",ans)