Browse Source

Refactoring: Added one more question. Pyramids.

main
fdlt3885 2 years ago
parent
commit
4eecff3cda
  1. 11
      src/main/quizproject.c

11
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[8];
while(k<8){
int num =rand()%8;
static int arr[9];
while(k<9){
int num =rand()%9;
for (p = 0; p < k; p++){ for (p = 0; p < k; p++){
if(arr[p]==num){ if(arr[p]==num){
break; break;
@ -104,6 +104,7 @@ void fifty_fifty(int question_num) {
"C.Russia\nD.USA\n", "C.Russia\nD.USA\n",
"A.Alaska\nB.Washington", "A.Alaska\nB.Washington",
"C.Toronto\nD.Ottawa", "C.Toronto\nD.Ottawa",
"A.Egypt\nB.Mexico",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);
} }
@ -225,6 +226,7 @@ void ask_questions(void) {
"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", "What is the capital of Canada?\n",
"What country are the Great Pyramids of Giza located in?\n",
}; };
char qC[][100] = {//6 char qC[][100] = {//6
@ -236,6 +238,7 @@ void ask_questions(void) {
"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", "A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa",
"A.Egypt\nB.Mexico\nC.Iceland\nD.Greenland",
}; };
@ -249,6 +252,7 @@ void ask_questions(void) {
'C', 'C',
'A', 'A',
'D', 'D',
'A',
}; };
int* arr = randomNumber(); int* arr = randomNumber();
@ -368,6 +372,7 @@ void hint(int question_num) {
"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.", "Hint:It is the 4th largest city in Canada.",
"Hint:It is a dry Country.",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);

Loading…
Cancel
Save