So I started learning how to use C++ yesterday and I forget how to do something basic. I used to know how to do this, but I forget. So whenever I start this up it shows up. If you press either 1 or 2 (which is supposed to show you text), it shuts down. So how do I prevent this from shutting down? The code I already wrote is below and I use Dev-C++.
If you haven't noticed I'm trying to make an text adventure game. So if I did anything wrong tell me how it's supposed to be done so I don't write paragraphs upon paragraphs of code that won't work how it's supposed to work.
Code:#include <iostream> #include <conio.h> using namespace std; int main() { int checkoutknights; cout<<"After the long, failed journey to pursue the Black Monster,\nyou're finally ready to go home. You're in a forest and decided\nto rest and read a bulletin. It reads 'change of war more likely'.\nSuddenly you hear a group of knights galloping on their horses\na few meters ahead. What do you do?\n\n1: Go check it out.\n2: Stay here and ignore them.\n"; { if (checkoutknights == 1) cout<<"You go and check out the knights only to see that they already left.\nYou decide to go back when two knights behind the group\nconfront you.\n"; } { if (checkoutknights == 2) cout<<"You stay where you are and ignore the knights. Eventually you stop hearing them.\n"; } cin.get(); }



LinkBack URL
About LinkBacks



