C语言:
include
include
using namespace std;
int main( )
{
int sum = 0;
cout << “请输入一串整数和任意数目的空格:”;
int i;
while(cin >> i)
{
sum += i;
while( cin.peek() == ’ ’ )
{
cin.get();
}
while( cin.peek() == ‘\n’)
{
break;
}
}
cout << “结果是:” << sum << end1;
return 0;
}