How to loop?

I've been experimenting with dialogue stuff in C++ and need to add an option at the end to start over at the beginning, like it's a small text based game. Here's my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>

using namespace std;

int main ()
{
    char response;
        cout << "Hello. My name is Suicide.exe. Would you like to end it all today? (Y/N)\n";
        cin >> response;
            if (response == 'Y')
            {
                cout << "Which of the following methods would you like to apply?\n";
                cout << "A. Gun\n";
                cout << "B. Knife\n";
                cout << "C. Potato\n";
                cin >> response;
                    if (response == 'A')
                    {
                        cout << "You have been shot to death.\n"; 
                        cout << "Thank you for dying with Suicide.exe.\n";
                        system("pause");
                    }
                    else if (response == 'B')
                    {
                        cout << "You have been stabbed to death.\n"; 
                        cout << "Thank you for dying with Suicide.exe.\n";
                        system("pause");
                    }
                    else if (response == 'C')
                    {
                        cout << "Potatoes are not a valid form of suicide.\n"; 
                        cout << "Thank you for wasting time with Suicide.exe.\n";
                        system("pause");
                    }
            }
            else if (response == 'N')
            {
                cout << "Would you like to:\n";
                cout << "A. Discuss alternatives\n";
                cout << "B. Exit\n";
                cin >> response;
                    if (response == 'A')
                    {
                        cout << "Which alternative would you like?\n";
                        cout << "A. Suicide\n";
                        cout << "B. Suicide\n";
                        cout << "C. Suicide\n";
                        cin >> response;
                        cout << "You have chosen: " << response << "\n";
                        cout << "Thank you for dying with Suicide.exe.\n";
                        system("pause");
                    }
                    else if (response == 'B')
                    {
                        cout << "Thank you for wasting time with Suicide.exe\n";
                        cout << "Goodbye.\n";
                        system("pause");
                    }
            }
    return 0;
}


What do I need to add?
1
2
3
4
5
6
7
8
9
10
11
12
13
int main()
{
    while(true)
    {
        //...program...
        cout << "Do you want to quit? (Y/N)" << endl;
        cin >> response;
        if(response == 'Y' || response == 'y')
        {
            break;
        }
    }
}
Topic archived. No new replies allowed.