we have only learned while loops. That is why I am so confused.
Printable View
we have only learned while loops. That is why I am so confused.
In that case, use a while loop like this instead of a for loop:
Code:int i = 1;
while (i <= n) {
// Insert code to request and read in user input and compute the sum
// ...
++i;
}
I have this code:
But I don't know how to make the sum after this. Could you just help me STILL (sorry) PLEASE? With a cherry on top?Code:numValues = 0;
while (numValues < 5) {
numValues++;
cout << "Enter value " << numValues << ": ";
cin >> numEntered;
You have the right idea in your original code:
Code:sum += numEntered;
Thank you so much! I have it and I don't know what I did differently from the time before, but hey it works and thank you again. Seriously!!