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:
#include <iostream>
usingnamespace 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");
}
elseif (response == 'B')
{
cout << "You have been stabbed to death.\n";
cout << "Thank you for dying with Suicide.exe.\n";
system("pause");
}
elseif (response == 'C')
{
cout << "Potatoes are not a valid form of suicide.\n";
cout << "Thank you for wasting time with Suicide.exe.\n";
system("pause");
}
}
elseif (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");
}
elseif (response == 'B')
{
cout << "Thank you for wasting time with Suicide.exe\n";
cout << "Goodbye.\n";
system("pause");
}
}
return 0;
}