Help with a code || BEGINER ||

Where there is " What is apple called in french" It doesn't wait for user to reply, and at match.. it is always wrong. Can someone check it out? Thanks
Also how do i add points?
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
125
126
127
128
129
130
131
#include <iostream>
#include <string>

int main()
{
    std::string name, mood;

    std::cout << "Hello! What is your name?    " ;
    std::cin >> name;
    std::cout << "How are you " << name << "?   " ;
    std::cin >> mood;

    if(mood == "good" || mood == "Good"){
        std::cout << "Thats great to hear!\n " << name   ;
    }
    else if(mood == "great" || mood == "Great"){
        std::cout << "Thats amazing! \n" << name   ;
    }
    else if(mood == "okay" || mood == "Ok"){
        std::cout << "Cool! \n " << name  ;
    }
    else if(mood == "bad" || mood == "Bad"){
        std::cout << "Aww, it gets better don't worry \n" << name   ;
    }
    else if(mood == "awful" || mood== "Awful"){
        std::cout << "Aww, I am so sorry to hear.. It gets better \n" << name  ;
    }
    else{
        std::cout << "Mhmm... \n" ;
    }
    std::cout << " how old are you?    " ;
    int age ;
    std::cin >> age ;
    if ( age <= 10)
        std::cout << "Wow that's young! I am 14. \n"  ;
    else if ( age >= 11 && age <= 13 )
        std::cout << "Cool! I am 14. \n"  ;
    else if ( age == 14)
        std::cout << "Really? I am 14 too! \n"  ;
    else if ( age >= 14 && age <= 90 )
        std::cout << "Nice! I am 14 \n"  ;
    else if ( age >= 91 && age <= 120 )
        std::cout << "How did you even do that! I am 14. \n"  ;
    else
        std::cout << "Are you like dead or something? \n"  ;
    std::cout << "Hey! While you are here.. Wanna try out my quiz? yes or no? Use all lowercase    ";
    std::string yes,no,a;

    yes = "yes";
    no = "no";

    std::cin >> a;
    if ( a == yes ) {
        std::cout << "Okay then!" ;
    }
    else if ( a == no ) {
        std::cout << "Aww.. Oh well, we can do it another time ! \n"  ;
        std::cout << "Bye bye now! \n"  ;
    }
    else {
        std::cout << "Aww.. Oh well, we can do it another time! \n Bye bye now! \n"  ;
    }
    std::cout << "Get ready!!" << '\n';
    std::cout << "Before we start, you must only write in the answer all" << '\n';
    std::cout << "lowercase letters and watch your spelling!" << '\n';
    std::cout << "I check everything!" << '\n';
    std::cout << "Question one! What is the highest mountain in the world?" << '\n';
    std::cout << "Just answer the name of the mountain." << '\n';
    std::string q,w,e,r,t,y;
    std::string z;
    q = "mount everest";
    w = "pomme";
    e = "match";
    r = "500";
    t = "13";
    y = "titan";
    std::cin >> z;
    if ( z == q || z == "mount everest" ){
        std::cout << "Good job! You got it right! Second question:" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. Lets continue. Second question:" << '\n';
    }
    std::cout << "What is apple called in french?" << '\n';
    std::cin >> z;
    if ( z == w ){
        std::cout << "Good job! You got it right! Third question:" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. Lets continue. Third question:" << '\n';
    }
    std::cout << "You are in a dark room. What do you light first?" << '\n';
    std::cout << "Match, candle, fire or lamp? " << '\n';
    std::cin >> z;
    if ( z == e ){
        std::cout << "Good job! You got it right! Fourth question:" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. Lets continue. Fourth question:" << '\n';
    }
    std::cout << "How much is (100*4)+ 500-400?" << '\n';
    std::cin >> z;
    if ( z == r ){
        std::cout << "Good job! You got it right! Fifth question:" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. Lets continue. Fifth question:" << '\n';
    }
        std::cout << "How much is 1+1+1+1+1+1+1+1+1+1+1+1+1*0+1?" << '\n';
    std::cin >> z;
    if ( z == t ){
        std::cout << "Good job! You got it right! Last question:" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. Lets continue. Last question:" << '\n';
    }
    std::cout << "What is Saturn's biggest natural satelite?" << '\n';
    std::cin >> z;
    if ( z == y ){
        std::cout << "Good job! You passed the quiz! You got n points (still working on it xD)" << '\n';
    }
    else {
        std::cout << "Ouch, not right sorry. You passed the quiz! You got n points" <<'\n';
        std::cout << "(still working on it xD):" << '\n';
    }
    std::cout << "Bye bye now! Thanks for hanging out with me! :D <3" << '\n';
    std::cout << "~=AKSA=~" << '\n';
    std::string h;
    std::cin >> h;

}
Do you realize that the extraction operator>> stops processing a string when it encounters a whitespace character, leaving all the other characters in the input buffer.

So on the previous entry you entered "mount everest" only "mount" was accepted for that input, and "everest" was left in the buffer to be used by the next input operation.

You should probably be using getline() instead of the extraction operator>> form all of your strings. And remember C++ is case sensitive "Mount" is not the same as "moUnt" or "mount".
Thank you so much, but how do i make it no case sensitive for a word and make _ allowed?
how do i make it no case sensitive for a word

The easiest way is to convert the strings to either upper or lower case.

and make _ allowed?

I assume you mean spaces allowed? If so that's what getline() is for.
Topic archived. No new replies allowed.