一个简单的c++程序,大家是怎么结束输入的?
#include <iostream>int main()
{
int sum = 0, value;
// read till end-of-file, calculating a running total of all values read
while (std::cin >> value)
sum += value; // equivalent to sum = sum + value
std::cout << "Sum is: " << sum << std::endl;
return 0;
}
[[it] 本帖最后由 为爱西行 于 2008-11-14 12:15 编辑 [/it]]