📌  相关文章
📜  在 C++ 代码示例中输入 n 个空格分隔的整数

📅  最后修改于: 2022-03-11 14:44:45.072000             🧑  作者: Mango

代码示例1
int main() {
int sum = 0;
cout << "enter number" << endl;
int i = 0;
while (true) {
    cin >> i;
    sum += i;
    //cout << i << endl;
    if (cin.peek() == '\n') {
        break;
    }
    
}

cout << "result: " << sum << endl;
return 0;
}