Thread: help, please

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003

    Thumbs down help, please

    Here is the code. The prog pops up then dissappears:
    #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")
                     cout << "You pick up the glint. It is a keycard to the NETWORK." << endl;
                     int getglint;
                     getglint = 1;
                     cin >> glint;
        return 0;

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    I'd guess you still have input in the buffer that .ignore() isn't catching. You can try the c++ method suggested here or use cin.ignore(100, '\n'); (where 100 is the max number bytes to ignore.. The default is 1).
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed