#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int time,x,y,r,yee,d;
cin >> time;
for(time==time;0<time;time--){
cin >> x >> y;
r=sqrt( ( x - 0 ) + ( y - 0 ) );
yee=100-r*r;
if(yee>0 && yee<=30){
cout << "sad!" << endl;
}
else if(yee>30 && yee<=60){
cout << "hmm~~" << endl;
}
else if(yee>60 && yee<100){
cout << "Happyyummy" << endl;
}
else{
cout << "evil!!" << endl;
}
}
return 0;
}
這樣子哪裡錯了!
#include
#include
using namespace std;
int main()
{
int time,x,y,r,yee,d;
cin >> time;
for(time==time;0<time;time--){
cin >> x >> y;
r=sqrt( ( x - 0 ) + ( y - 0 ) );
yee=100-r*r;
if(yee>0 && yee<=30){
cout << "sad!" << endl;
}
else if(yee>30 && yee<=60){
cout << "hmm~~" << endl;
}
else if(yee>60 && yee<100){
cout << "Happyyummy" << endl;
}
else{
cout << "evil!!" << endl;
}
}
return 0;
}
這樣子哪裡錯了!
提示: 變數型態會影響結果的進位與不進位