【問題】哪裡錯???


Recommended Posts

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

{

float foot,an,ra,ch;

cout<<"輸入腳幾隻"<<;

cin>>foot;

cout<<"輸入動物幾隻"<<;

cin>>an;

ch=(4*an-foot)/2

ra=(foot-2*an)/2

cout<<"雞幾隻"<<ch;

cout<<"兔幾隻"<<ra;

system("PAUSE");

return EXIT_SUCCESS;

}

鏈接文章
分享到其他網站
  • 2 weeks later...
tmp1.cpp(9) : error C2059: syntax error : ';'

tmp1.cpp(11) : error C2059: syntax error : ';'

tmp1.cpp(15) : error C2146: syntax error : missing ';' before identifier 'ra'

tmp1.cpp(16) : error C2146: syntax error : missing ';' before identifier 'cout'

所以該改成:

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
float foot,an,ra,ch;
cout<<"輸入腳幾隻"<<[U][B]endl[/B][/U];
cin>>foot;
cout<<"輸入動物幾隻"<<[U][B]endl[/B][/U];
cin>>an;

ch=(4*an-foot)/2[U][B];[/B][/U]
ra=(foot-2*an)/2[B][U];[/U][/B]
cout<<"雞幾隻"<<ch<<endl;
cout<<"兔幾隻"<<ra<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}

鏈接文章
分享到其他網站
  • 1 month later...

請登入後來留意見

在登入之後,您才能留意見



立即登入