forked from nsrCodes/High-School-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuiz.cpp
More file actions
204 lines (173 loc) · 4.99 KB
/
Quiz.cpp
File metadata and controls
204 lines (173 loc) · 4.99 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// do check randomizing...............
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
int point=0,life=3,q=1;
void main()
{
randomize();
void quiz(int);
clrscr();
int Q;
cout<<" Welcome to the Mind Tester...."<<endl<<endl;
getch();
cout<<"The rules of this game are simple :"<<endl;
getch();
cout<<endl<<" 1. We will display a question and four corresponding choices"<<endl<<" out of which only one is correct"<<endl<<" 2. Choose the option which you feel is correct."<<endl<<" 3. You have only three lives, PLAY CAREFULLY!!!"<<endl<<" 4. For every correct answer you will be awarded 5 points"<<endl;
getch();
cout<<endl<<" So, hope you are ready because your mind is about to be tested.... GOOD LUCK "<<endl;
getch();
do
{
clrscr ();
cout<<" Points : "<<point<<endl<<" Lives : "<<life<<endl<<endl;
Q=random(10);
quiz(Q);
q++;
if(life==0)
break;
getch();
}while(point<50);
getch();
if(life==0)
cout<<"GAME OVER"<<endl<<endl<<"You scored "<<point<<" points "<<endl<<endl<<" Better luck next time "<<endl;
getch();
}
void quiz(int Q)
{
void ans(int,int);
int C;
switch(Q)
{
case 0: cout<<"Q"<<q<<" Which one of the following is a noble gas ? "<<endl<<endl<<" 1. Radium"<<endl<<" 2. Thorium "<<endl<<" 3. Radon "<<endl<<" 4. Flourine"<<endl ;
break;
case 1: cout<<"Q"<<q<<" Who was the first Indian to win a noble prize? "<<endl<<endl<<" 1. Dr. C V Raman"<<endl<<" 2. Mother Teresa "<<endl<<" 3. Kailash Satyarthi "<<endl<<" 4. Rabindranath Tagore "<<endl ;
break;
case 2: cout<<"Q"<<q<<" Who discovered penicillin ? "<<endl<<endl<<" 1. Alexander Fleming"<<endl<<" 2. Louis Pasteur"<<endl<<" 3. Madame Curie "<<endl<<" 4. Alexander Grahm Bell"<<endl ;
break;
case 3: cout<<"Q"<<q<<" Who discovered neutron ? "<<endl<<endl<<" 1. J J Thomson "<<endl<<" 2. Ernest Rutherford "<<endl<<" 3. Erwin Schrodinger "<<endl<<" 4. James Chadwick "<<endl ;
break;
case 4: cout<<"Q"<<q<<" Who was the first President of India ? "<<endl<<endl<<" 1. Pranab Mukherjee"<<endl<<" 2. Rajendra prasad"<<endl<<" 3. Pratibha Patil"<<endl<<" 4. Sarvepalli Radhakrishnan"<<endl ;
break;
case 5: cout<<"Q"<<q<<" What is the national sport of India ? "<<endl<<endl<<" 1. Cricket "<<endl<<" 2. Hockey"<<endl<<" 3. Football "<<endl<<" 4. Chess"<<endl ;
break;
case 6: cout<<"Q"<<q<<" Which of the following is not a web Browser ? "<<endl<<endl<<" 1. Internet Explorer"<<endl<<" 2. Mozilla Firefox "<<endl<<" 3. Appple Safari "<<endl<<" 4. Microsoft Surfer "<<endl ;
break;
case 7: cout<<"Q"<<q<<" Who wrote the book Wings of Fire ? "<<endl<<endl<<" 1. Dr. A P J Abdul Kalam"<<endl<<" 2. William Shakespeare "<<endl<<" 3. Rabindranath Tagore "<<endl<<" 4. Navdeep Singh Rathore"<<endl;
break;
case 8: cout<<"Q"<<q<<" Which of the following sports does Tiger Woods play? "<<endl<<endl<<" 1. Basketball"<<endl<<" 2. Baseball "<<endl<<" 3. Football"<<endl<<" 4. Golf"<<endl;
break;
case 9: cout<<"Q"<<q<<" What is the capital of Tripura? "<<endl<<endl<<" 1. Agartala "<<endl<<" 2. Aizwal "<<endl<<" 3. Kohima"<<endl<<" 4. Itanagar"<<endl ;
break;
/* case 10:cout<<"Q"<<q<<" "<<endl;
break;*/
}
cin>>C;
ans(Q,C);
}
void ans(int Q,int C)
{
int x=0;
switch(Q)
{
case 0: if (C!=3)
{
x++;
cout<<"\n Wrong answer.... The answer is (3)"<<endl;
}
break;
case 1: if (C!=4)
{
x++;
cout<<"\n Wrong answer.... The answer is (4)"<<endl;
}
break;
case 2: if (C!=1)
{
x++;
cout<<"\n Wrong answer.... The answer is (1)"<<endl;
}
break;
case 3: if (C!=4)
{
x++;
cout<<"\n Wrong answer.... The answer is (4)"<<endl;
}
break;
case 4: if (C!=2)
{
x++;
cout<<"\n Wrong answer..... The answer is (2)"<<endl;
}
break;
case 5: if (C!=2)
{
x++;
cout<<"\n Wrong answer..... The answer is (2)"<<endl;
}
break;
case 6: if (C!=4)
{
x++;
cout<<"\n Wrong answer..... The answer is (4)"<<endl;
}
break;
case 7: if (C!=1)
{
x++;
cout<<"\n Wrong answer...... The answer is (1)"<<endl;
}
break;
case 8: if (C!=4)
{
x++;
cout<<"\n Wrong answer...... The answer is (4)"<<endl;
}
break;
case 9:if (C!=1)
{
x++;
cout<<"\n Wrong anwer..... The answer is (1)"<<endl;
}
break;
}
if(x==0)
{
cout<<endl<<endl<<" Correct anwer"<<endl;
point=point+5;
if(point==5)
{
getch();
cout<<" You just earned your first 5 points "<<endl;
}
if(point==20)
{
getch();
cout<<" I think you are a smartie.... "<<endl;
}
if(point==35)
{
getch();
cout<<" You are playing quite well "<<endl;
}
/** if(point==50)
cout<<" Wooh hooo you just won the game, CONGRATULATIONS!!! ";
*/
}
else
{
life--;
if(life==2)
{
getch();
cout<<" Hey gamer, you just lost a life. Be a little more careful on the next one."<<endl;
}
if(life==3)
{
getch();
cout<<" You only one life left, another wrong answer and Game over "<<endl;
}
}
}