int number, sum = 0, count = 0;
cout << "Enter 10 negative numbers:\n";
while (++count <= 10)
{
cin >> number;
if (number >= 0)
{
cout << "ERROR: positive number"
<< " or zero was entered as the\n"
<< count << "th number! Input ends "
<< "with the " << count << "th number.\n"
<< count << "th number was not added in.\n";
break;
}
sum = sum + number;
}
cout << sum << " is the sum of the first "
<< (count - 1) << " numbers.\n";
I do not understand how the multiple numbers are being input into a single variable and how the sum is being calculated. (I can't find the answer in this book)
I know I am missing something basic here, but if someone could give me pointer in the right direction, I sure would appreciate it.