#include <iostream>
usingnamespace std;
int main ()
{
char response
cout << "Hello. My name is Suicide.exe. Would you like to end it all today?\n";
cin >> response;
if (response == 'y' or 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' or response == 'A')
{
cout << "You have been shot to death. Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'b' or response == 'B')
{
cout << "You have been stabbed to death. Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'c' or response == 'C')
{
cout << "Potatoes are not a valid form of suicide. Thank you for wasting time with Suicide.exe.\n";
}
}
elseif (response == 'n' or response == 'N')
{
cout << "Would you like to:\n";
cout << "A. Discuss alternatives\n";
cout << "B. Exit\n";
cin >> response;
if (response == 'a' or 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;
cout << "Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'b' or == 'B')
{
cout << "Thank you for wasting time with Suicide.exe\n";
cout << "Goodbye.\n";
}
{
return 0;
}
I switched from Dev-C++ to wxDev-C++ so I'm not sure if it should be different or if I'm just missing a simple error.
I'm pretty sure it's just the IDE/compiler, so it shouldn't make a difference. That semicolon fixed a decent amount of code though, now it's giving me errors at line 43
I have the code to the point where I dont get error messages, but now after I give input at the first cin the program just closes rather than displaying the next cout. Any fixes?
#include <iostream>
usingnamespace std;
int main ()
{
char response;
cout << "Hello. My name is Suicide.exe. Would you like to end it all today?\n";
cin >> response;
if (response == 'y' or 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' or response == 'A')
{
cout << "You have been shot to death. Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'b' or response == 'B')
{
cout << "You have been stabbed to death. Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'c' or response == 'C')
{
cout << "Potatoes are not a valid form of suicide. Thank you for wasting time with Suicide.exe.\n";
}
}
elseif (response == 'n' or response == 'N')
{
cout << "Would you like to:\n";
cout << "A. Discuss alternatives\n";
cout << "B. Exit\n";
cin >> response;
if (response == 'a' or 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;
cout << "Thank you for dying with Suicide.exe.\n";
}
elseif (response == 'b' or response == 'B')
{
cout << "Thank you for wasting time with Suicide.exe\n";
cout << "Goodbye.\n";
}
}
return 0;
}