[C++ Primer] 练习1.16

#include 

using std::cin;
using std::cout;
using std::endl;

int main() {
    int val = 0, sum = 0;
    while (cin >> val) {
        sum += val;
        cout << "total sum is " << sum << endl;
    }
}

你可能感兴趣的:([C++ Primer] 练习1.16)