char and trouper function

im new to c++ and recently i made a program my self and got it working but i stumbled upon this char and trouper function as 1 forum user suggest that i use it
here is the code
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
  #include <iostream>
#include <string>
         using namespace std;
         
         int main ()
         
{
         cout << "This is just for fun survey"<<endl;
         cout << "    So answer truthfuly"<<endl;
         bool answer = false;
         string q1;
         cout << "What is your name?"<<endl;
         getline (cin,q1);
         string q2;
         cout << "What is your age?"<<endl;
         getline (cin,q2); 
         string q3;
         cout << "Are you a Boy or a Girl? answer with B/G" <<endl;
         getline (cin,q3);
         string q6;
         cout << "Do you believe in GOD? answer with Y/N" <<endl;
         getline (cin,q6);
         
         if (q3=="B" || q3=="G")
         {
                     string q4;
                     if (q3=="B")
                     {
                     answer = true;
                     cout << "Did you ever had a girlfriend and loved her?" <<endl;
                     getline (cin,q4);
                     }
                     if (q3=="G")
                     {
                     answer = true;
                     cout << "Did you ever had a boyfriend and loved him?" <<endl;
                     getline (cin,q4);
                     }
                     q3=q3+", "+q4;
         }
         if (!answer)
            q3 = "Please answer properly with B/G and repeat the survey thank you!";
         if (q6=="Y" || q6=="N")
         {
                     string q5;
                     if (q6=="Y")
                     {
                     answer = true;
                     cout << "So you believe in GOD but why?" <<endl;
                     getline (cin,q5);
                     }
                     if (q6=="N")
                     {
                     answer = true;
                     cout <<"So you DONT believe in GOD but why?" <<endl;
                     getline (cin,q5);
                     }
                     q6=q6+", "+q5;
         }
          if (!answer)
            q6 = "Please answer properly with Y/N and repeat the survey thank you!";
            
         cout <<"You are: "<<q1<<endl;
         cout <<"Your age is: "<<q2<<endl;
         cout <<"You are: "<<q3<<endl;
         cout <<"And your belief is: "<<q6<<endl;
         
         system("PAUSE");
         return 0;
}

that is not the exact code that he suggests to use a char/trouper function i already fixed it my self..

the thing is he says that in q3 i should have rather use char/trouper function on it..

but what the heck is it? O.o

and how do i apply and use that function?

here is the link of the said thread..

http://www.cplusplus.com/forum/beginner/106226/
Hi xeimaster,

Have a look at the example on this page :

http://www.cplusplus.com/reference/cctype/toupper/


I should point out that there is a lot reference material on this site, as well as articles, and a tutorial. It is all at the top left of this page. I suggest you have a good read.
http://www.cplusplus.com/doc/tutorial/


Also, Googleing C++ toupper or some other function name works really well.

Probably a good idea to get a good book as well, there are lots of them: some good; some bad. If it was me I would go for something written by one of the big names Bjarne Stroustrup or Herb Sutter come to mind, but there are others.

HTH
ideasman,

thx for the info..

as i am not really good in searching and sometimes i do need some examples to learn things out tho i appreciate your help and with that i thank you..

and about the link..

i'll try to understand it on my own hope i do get it XD :)
Topic archived. No new replies allowed.