YEE 10 發表於 September 27, 2008 檢舉 Share 發表於 September 27, 2008 #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;} 鏈接文章 分享到其他網站
超級張小豪 10 發表於 September 27, 2008 檢舉 Share 發表於 September 27, 2008 你可以先使用一般手動的數學算法找出公式解這一個應該是國中的題目你可以解看看雞兔的數量你就會發現你輸出的數字是錯誤的了 鏈接文章 分享到其他網站
john0312 10 發表於 October 6, 2008 檢舉 Share 發表於 October 6, 2008 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;} 鏈接文章 分享到其他網站
ryan10328 10 發表於 November 26, 2008 檢舉 Share 發表於 November 26, 2008 初學C++很容易把結束的 ; 給忽略掉 =ˇ=所以就把它當成習慣每次打每次加 ; 鏈接文章 分享到其他網站
Recommended Posts
請登入後來留意見
在登入之後,您才能留意見
立即登入