Hi, I'm working on a program that is supposed to use a for loop to generate a number that runs in an increment to display numbers like 1,2,4,8,16,32,64...basically to double the number starting from 1.
Here is how my output should look:
and so on.
So far all I get when I run the program is either
Press any key to continue...
or it shows a one, but sits there for several seconds and does nothing then says "Press any key to continue".
The increment expression in a for loop need not always alter the loop
control variable by a fixed amount. Instead, the loop control variable
can change in any arbitrary way. Using this concept, write a program
that uses a for loop to generate and display the progression
1, 2, 4, 8, 16, 32, and so on.
int i = 1;
cout << i << " " << endl;
for(i > 0; i*2; i++)