The flowchart above represents an algorithm that displays the numbers 20, 40, 60, 80, 100, 120, 140, 160, 180 on the screen. Code the algorithm into a program using the while statement. The counter variable should be an int variable named count. Save and run the program. Test the program to see if you get the correct output. Correct any errors, when the program is running correctly copy and paste the IPO chart and the program code into a word document.
I just started C++ and I'm unsure of how to use the while statement and writing the code. Help would be appreciated. So far, here's my code:
#include <iostream>
using namespace std;
int main ()
{
int count;
count = 10
; while (count < 200) {
cout << count << ", ";
count*=2;
}
system("pause");
return 0;
}
How do I "add 10 to counter" and also display the numbers listed above? (20, 40, 60, 80, 100, 120, 140, 160, 180) so far, it only displays 10, 20, 40, 80, 160 I am unsure of how to also display the numbers in between while still doubling it? Thanks!