Browse Source

Refactoring: Added one more question. Frida Kahlo.

main
fdlt3885 2 years ago
parent
commit
7a3fe7b23c
  1. 12
      src/main/quizproject.c

12
src/main/quizproject.c

@ -9,9 +9,9 @@ char answers[NUM_QUESTIONS] = {'B', 'A'};
int* randomNumber() { int* randomNumber() {
srand(time(NULL)); srand(time(NULL));
int k = 0, p; int k = 0, p;
static int arr[10];
while(k<10){
int num =rand()%10;
static int arr[11];
while(k<11){
int num =rand()%11;
for (p = 0; p < k; p++){ for (p = 0; p < k; p++){
if(arr[p]==num){ if(arr[p]==num){
break; break;
@ -106,6 +106,7 @@ void fifty_fifty(int question_num) {
"C.Toronto\nD.Ottawa", "C.Toronto\nD.Ottawa",
"A.Egypt\nB.Mexico", "A.Egypt\nB.Mexico",
"A.Surat Thani\nB.Bangkok", "A.Surat Thani\nB.Bangkok",
"B.Mexico\nC.USA",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);
} }
@ -236,7 +237,7 @@ void ask_questions(void) {
"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", "What country are the Great Pyramids of Giza located in?\n",
"What is the capital of Thailand?\n", "What is the capital of Thailand?\n",
"In which country was Frida Kahlo born?\n",
}; };
char qC[][100] = {//6 char qC[][100] = {//6
"A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu", "A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu",
@ -249,6 +250,7 @@ void ask_questions(void) {
"A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa", "A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa",
"A.Egypt\nB.Mexico\nC.Iceland\nD.Greenland", "A.Egypt\nB.Mexico\nC.Iceland\nD.Greenland",
"A.Surat Thani\nB.Bangkok\nC.Phuket\nD.Pattaya City", "A.Surat Thani\nB.Bangkok\nC.Phuket\nD.Pattaya City",
"A.Austria\nB.Mexico\nC.USA\nD.India",
}; };
@ -264,6 +266,7 @@ void ask_questions(void) {
'D', 'D',
'A', 'A',
'B', 'B',
'B',
}; };
int* arr = randomNumber(); int* arr = randomNumber();
@ -397,6 +400,7 @@ void hint(int question_num) {
"Hint:It is the 4th largest city in Canada.", "Hint:It is the 4th largest city in Canada.",
"Hint:It is a dry Country.", "Hint:It is a dry Country.",
"Hint:The capital has the longest city name in the world.", "Hint:The capital has the longest city name in the world.",
"Hint:The Native language is Spanish.",
}; };
printf("%s\n",qC[question_num]); printf("%s\n",qC[question_num]);
} }

Loading…
Cancel
Save