Everyone has this problem. iF you do a search you will find other solutions. i use this.
Code:
#include <conio.h> // include this header file
#include <iostream.h>
#include <string>
#include <windows.h>
int main()
{
std::string plant;
std::string glint;
cout << "The world is about to be destroyed. You are in a futuristic spy base." << endl;
cout << "You will soon go on a mission to save the world. In the corner of the room," << endl;
cout << "you see a plant. The door is to the north and the basement is down." << endl;
std::string firstroom;
cin >> firstroom;
if(firstroom == "x plant")
{
cout << "As you examine the plant, you spot a glint of silver in the soil." << endl;
cin >> plant;
}
if(plant == "x glint" || "get glint")
{
plant:
cout << "You pick up the glint. It is a keycard to the NETWORK." << endl;
int getglint;
getglint = 1;
cin >> glint;
}
getch();// add this line it, it waits for any keystroke from user!!!!
return 0;
}
Just add the header file and that getch() line in front of your return 0 and it should work. IF not look around and find other ways that people do it.