勞駕管理員幫我看看這段代碼哪里錯了:
#include <iostream>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
cout << (a + b) << endl;
return 0;
}
雖然我不是管理員,但你的問題主要原因是:
輸入資料 不見得只有一筆
所以請參考a001的說明,改成以下的程式碼就會過了
這樣才會把所有的輸入資料都讀完
#include <iostream>
using namespace std;
int main() {
int a,b;
while(cin >> a >> b)
cout << (a + b) << endl;
return 0;
}