From 38b3a8af3c5880e23c0f284a9c9caf2047358e34 Mon Sep 17 00:00:00 2001 From: fdlt3885 Date: Thu, 26 Jan 2023 10:06:21 +0000 Subject: [PATCH] Refactoring: Added question. What's the capital of Canada? --- src/main/quizproject.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index f775e7f..d54cdd2 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -9,9 +9,9 @@ int* randomNumber() { srand(time(NULL)); 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++){ if(arr[p]==num){ break; @@ -103,6 +103,7 @@ void fifty_fifty(int question_num) { "C.Merida\nD.Mexico city", "C.Russia\nD.USA\n", "A.Alaska\nB.Washington", + "C.Toronto\nD.Ottawa", }; printf("%s\n",qC[question_num]); } @@ -191,6 +192,7 @@ void ask_questions(void) { "What is the capital of Mexico?\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 is the capital of Canada?\n", }; char qC[][100] = {//6 @@ -201,6 +203,7 @@ void ask_questions(void) { "A.Oaxaca\nB.Puebla\nC.Merida\nD.Mexico city", "A.India\nB.China\nC.Russia\nD.USA", "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', 'C', 'A', + 'D', }; 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: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 4th largest city in Canada.", + }; printf("%s\n",qC[question_num]); }