Send The User Back

Team,
I am trying to get this right in my head - but I can't get it to resolve.
Basically - This is what I need to do.

I have no problem repeating an ENTIRE program (I use return main(); and boom it works awesome). But I want to save myself and users some time. I want to send the user back to the beginning of the if. How would I go about doing that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main() {

cout << "stuff"
cin >> choice;
if (choice==1) {
cout << "do this";
cin >> user_business;
return to if - //don't want to repeat the whole program; just this if bracket. 



}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

int main()
{

    bool fQuit {false};
    while (!fQuit)
    {
        std::cout << "enter your choice \n";
        int choice{};
        std::cin >> choice;
        if (choice == 1)
        {
            std::cout << "enter user business \n";
            int user_business{};
            std::cin >> user_business;
            std::cout << user_business << "\n";
        }
        else
        {
            fQuit = true;
        }
    }
}
Topic archived. No new replies allowed.