From 59af38c8645206dfde84e935e0ae9fd331fac4d5 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Thu, 26 Jan 2023 12:36:31 +0000 Subject: [PATCH] Refactoring: Added one more question. Capital of Thailand. --- src/main/quizproject.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 04b09be..e6628de 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -9,9 +9,9 @@ char answers[NUM_QUESTIONS] = {'B', 'A'}; int* randomNumber() { srand(time(NULL)); int k = 0, p; - static int arr[9]; - while(k<9){ - int num =rand()%9; + static int arr[10]; + while(k<10){ + int num =rand()%10; for (p = 0; p < k; p++){ if(arr[p]==num){ break; @@ -105,6 +105,7 @@ void fifty_fifty(int question_num) { "A.Alaska\nB.Washington", "C.Toronto\nD.Ottawa", "A.Egypt\nB.Mexico", + "A.Surat Thani\nB.Bangkok", }; printf("%s\n",qC[question_num]); } @@ -234,6 +235,7 @@ void ask_questions(void) { "What U.S. state is home to no documented poisonous snakes?\n", "What is the capital of Canada?\n", "What country are the Great Pyramids of Giza located in?\n", + "What is the capital of Thailand?\n", }; char qC[][100] = {//6 @@ -246,6 +248,7 @@ void ask_questions(void) { "A.Alaska\nB.Washington\nC.Ohio\nD.California", "A.Vancouver\nB.Montreal\nC.Toronto\nD.Ottawa", "A.Egypt\nB.Mexico\nC.Iceland\nD.Greenland", + "A.Surat Thani\nB.Bangkok\nC.Phuket\nD.Pattaya City", }; @@ -260,6 +263,7 @@ void ask_questions(void) { 'A', 'D', 'A', + 'B', }; int* arr = randomNumber(); @@ -392,7 +396,7 @@ void hint(int question_num) { "Hint:It is the coldest state in the US.", "Hint:It is the 4th largest city in Canada.", "Hint:It is a dry Country.", - + "Hint:The capital has the longest city name in the world.", }; printf("%s\n",qC[question_num]); }