牛客输入输出在线练习

https://www.nowcoder.com/question/next?pid=27976983&qid=235785&tid=45624435

 

#include <iostream>
using namespace std;
int main(){
    int sum=0;
    int temp;
    while(cin>>temp){
        sum += temp;
        if(cin.get()=='\n'){
            cout<<sum<<endl;
            sum = 0;
        }
    }
}

 

posted @ 2021-07-17 20:20  三一一一317  阅读(91)  评论(0)    收藏  举报