Browse Source

Refactoring: Added question. What's the capital of Canada?

main
fdlt3885 2 years ago
parent
commit
38b3a8af3c
  1. 12
      src/main/quizproject.c

12
src/main/quizproject.c

@ -9,9 +9,9 @@
int* randomNumber() { int* randomNumber() {
srand(time(NULL)); srand(time(NULL));
int k = 0, p; int k = 0, p;
static int arr[6];
while(k<6){
int num =rand()%6;
static int arr[8];
while(k<8){
int num =rand()%8;
for (p = 0; p < k; p++){ for (p = 0; p < k; p++){
if(arr[p]==num){ if(arr[p]==num){
break; break;
@ -103,6 +103,7 @@ void fifty_fifty(int question_num) {
"C.Merida\nD.Mexico city", "C.Merida\nD.Mexico city",
"C.Russia\nD.USA\n", "C.Russia\nD.USA\n",
"A.Alaska\nB.Washington", "A.Alaska\nB.Washington",
"C.Toronto\nD.Ottawa",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);
} }
@ -191,6 +192,7 @@ void ask_questions(void) {
"What is the capital of Mexico?\n", "What is the capital of Mexico?\n",
"What is the name of the largest country in the world?\n", "What is the name of the largest country in the world?\n",
"What U.S. state is home to no documented poisonous snakes?\n", "What U.S. state is home to no documented poisonous snakes?\n",
"What is the capital of Canada?\n",
}; };
char qC[][100] = {//6 char qC[][100] = {//6
@ -201,6 +203,7 @@ void ask_questions(void) {
"A.Oaxaca\nB.Puebla\nC.Merida\nD.Mexico city", "A.Oaxaca\nB.Puebla\nC.Merida\nD.Mexico city",
"A.India\nB.China\nC.Russia\nD.USA", "A.India\nB.China\nC.Russia\nD.USA",
"A.Alaska\nB.Washington\nC.Ohio\nD.California", "A.Alaska\nB.Washington\nC.Ohio\nD.California",
"A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa",
}; };
@ -213,6 +216,7 @@ void ask_questions(void) {
'D', 'D',
'C', 'C',
'A', 'A',
'D',
}; };
int* arr = randomNumber(); int* arr = randomNumber();
@ -303,6 +307,8 @@ void hint(int question_num) {
"Hint:It is one of the oldest and largest cities in the Americas.\n", "Hint:It is one of the oldest and largest cities in the Americas.\n",
"Hint:The area of the largest country is 17.1 million km2.\n", "Hint:The area of the largest country is 17.1 million km2.\n",
"Hint:It is the coldest state in the US.", "Hint:It is the coldest state in the US.",
"Hint:It is the 4th largest city in Canada.",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);
} }

Loading…
Cancel
Save