学习C Plus Plus
#include <iostream>using namespace std;
int main(void)
{
int sum = 0;
cout << "Please input the number:";
int i;
while(cin >> i)
{
sum += i;
while(cin.peek() == ' ')
{
cin.get();
}
if(cin.peek() == '\n')
{
break;
}
}
cout << "The result is:" << sum <<endl;
return 0;
}
页:
[1]