Troublesome if else statements

I have no idea what keeps going on with my if else statements. I have tried to layer them and they appear relatively complex but the compiler seems to ignore them and just continue on with the program regardless of the answer the user gives. I am attempting to make an air-themed text RPG and I am fairly new to C++. Help would be much appreciated. Thank you in advance.

Code for reference:

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <string>
#include <iostream>
#include <unistd.h>
#include <stdio.h>

using namespace std;

void slowPrint(unsigned long speed, const char *s) {
	int i = 0;
	while(s[i]!=0) {
		cout << s[i++];
		cout.flush();
		usleep(speed);
	}
}


int main()
{
     //Note
    slowPrint(50000, "Just an fyi, when a line ends with '...', you should reply. Regarding info, an 'ok'");
    slowPrint(50000, " will work fine\n");
    string ok = "ok";
    string yes = "yes";
    string no = "no";
    // First OK
    
    if (cin >> ok)
    {
        cout << " "<< endl;
    }
    else
    {
        cout << " " << endl;
    }
    //Starting intro
    
    slowPrint (50000, "Sarge: Pilot. Thank you for registering into the Royal Airforce. Now lets see, your");
    slowPrint (50000, " name is...");
    string playername;
    cin >> playername;
    slowPrint (50000, "Sarge: Welcome to the RAF, ");
    cout << playername;
    slowPrint (50000, ". We are happy to have you.\n");
    cout << " "<< endl;
    slowPrint (50000, "Sarge: Now we require a few medcical checks, see you back here in a few hours...\n");
    string ok1 = "ok";
    if (cin >> ok1)
    {
        cout << "           A few hours later\n           " << endl;
    }
    else
    {
        cout << "           A few hours later\n           " << endl;
    }
    //briefing Start
    
    slowPrint (50000, "S: Pilot, We are very impressed with your credentials; You worked for the SAS for 8 years I hear?\n");

    
    //yes
    
    if (cin  >> yes)
    {slowPrint (50000, "S: Excellent, and I hear you also personally worked for the Prime Minister?");
                   if (cin >> yes)
                   {
                       slowPrint (50000, "S: We are extremely grateful to have you with us,");
                   }
                   if (cin >> no)
                   {
                       slowPrint (50000, "S: Oh, well we normally don't get things wrong ");
                   }
                   else
                   {
                       slowPrint (50000, "S: Okay, thank you again for joining us ");
                       
                   }
    cout << playername;
    slowPrint (50000, ".");
    }
    
    //no
    
    if (cin >> no)
    {
        slowPrint (50000, "S: Oh, well I apologise, ");
    cout << playername;
    slowPrint (50000, " S: We do not normally make mistakes. Nevertheless, we are grateful to have you with us; my men have told me that you worked personally for the PM?");
        if (cin >> yes)
        {
            slowPrint (50000, " S: Excellent. Thank you for joining us.");
        }
        if (cin >> no)
        {
        slowPrint (50000, "S: It is perfectly fine, there is no need to keep secrets from us, ");
        cout << playername;
        }
        else
        {       slowPrint (50000, " S: Ok, thank you again for joining us.");
    }
    }
    //else
                
        else
        {
            slowPrint (50000, "S: Ok, and I hear you also worked for the PM?");
                   if (cin >> yes)
                   {
                       slowPrint (50000, " S: Excellent. Thank you for joining us.");
                   }
                              if (cin >> no)
                              {
                                  slowPrint (50000, "S: It is perfectly fine, there is no need to keep secrets from us, ");
                              cout << playername;
                              }
                              else
                              {
                              slowPrint (50000, " S: Ok, thank you again for joining us.");
                              }
        }
                              
    };

cin >> (some variable) doesn't give you variable with the new data in it.

It just lets you check whether or not the data was read successfully.

Even if it did, you are not checking the data against anything; it is about as meaningful as typing:

if("stuff")
fideraco, so how would I go about making it true? would I equal it to 0?
Topic archived. No new replies allowed.