How to fix my code to follow the sequence

Pages: 12
Is there anyway to return to the beginning [...] of the loop
continue;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Example program
#include <iostream>
int main()
{
    for (int i = 0; i < 10; i++)
    {
        if (i < 4) // contrived...   
        {
            continue;
        }
        
        std::cout << "i >= 4, i = " << i << '\n';
    }
}
Last edited on
@OP,

Move your 'do' to line 51 and the while to line 97. You want to prompt for and re-input each time through the loop. Lines 53 - 57 need to be inside the loop.

After that, you won't need the extra level of indentation from lines 60 - 96.

Topic archived. No new replies allowed.
Pages: 12