How Can I Fix This Problem

i dont like what it is doing. the user type in "A" and it answers the first one but it also answers the second one. i want it to answer the first and then wait and give it choices for the second one and then answer that one but it answers both. ho can i stop that from happening

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 #include <iostream>

using namespace std;

int main()
{
    string answer;

    cout << "This Is A Short Game" << endl;
    cout << "Choices: A,B,C,D" << endl;

    cout << "YOU ARE WALKING HOME FROM SCHOOL AND YOU SEE A DOG" << endl;

    cout << "A: Walk Up To It And Pet It" << endl;
    cout << "B: Continue Walking Home" << endl;
    cin >> answer;

    if (answer=="A") {
        cout << "YOU START WALKING TO THE DOG, IT LOOKS UP AT YOU SCARED" << endl;
    }

    cout << "A: PET IT" << endl;

    if (answer=="A") {
        cout << "YOU PET THE DOG IT BARKS AND WAGS IT'S TAIL IN EXCITEMENT" << endl;
    }

    return 0;
}
You're only inputting answer once (line 16). If you want to ask another question, then you need to input answer again.
Topic archived. No new replies allowed.