C++

4396y 发表于 1年前 · 关联问题 计算数的和

include "pch.h"

include

using namespace std;

int main() {

int n; int sum = 0; while (cin>>n) { if (n == 0) { break; } else if(n<0) { continue; } else { sum += n; }

} cout << sum;

}