Browse Source

refactoring: change in ask_questions

main
parent
commit
f213c68183
  1. 20
      src/main/quizproject.c

20
src/main/quizproject.c

@ -30,11 +30,11 @@ void displayWelcomeMessage(void) {
printf("\t\t Welcome to The Quiz \n\n"); printf("\t\t Welcome to The Quiz \n\n");
printf("\t\t------------------------------------------\n"); printf("\t\t------------------------------------------\n");
printf("\t\t------------------------------------------\n\n"); printf("\t\t------------------------------------------\n\n");
printf("\t\t Press 'Enter' to begin the Game \n");
char startGame;
scanf("%c", &startGame);
startGame = toupper(startGame);
if (startGame != ' ') {
printf("\t\t Press 'Enter' to join the Game \n");
char joinGame;
scanf("%c", &joinGame);
joinGame = toupper(joinGame);
if (joinGame != ' ') {
char vorName[100] ={0}; char vorName[100] ={0};
char nachName[100] ={0}; char nachName[100] ={0};
printf("\t\t Please enter your First Name \n"); printf("\t\t Please enter your First Name \n");
@ -228,7 +228,7 @@ int k = 0;
} }
void ask_questions(void) { void ask_questions(void) {
char qS[][100] = {
char questions[][100] = {
"What is the name of the tallest mountain in the world?\n", "What is the name of the tallest mountain in the world?\n",
"Which country has the largest population in the world??\n", "Which country has the largest population in the world??\n",
"What is the name of the longest river in Africa?\n", "What is the name of the longest river in Africa?\n",
@ -241,7 +241,7 @@ void ask_questions(void) {
"What is the capital of Thailand?\n", "What is the capital of Thailand?\n",
"In which country was Frida Kahlo born?\n", "In which country was Frida Kahlo born?\n",
}; };
char qC[][100] = {//6
char possible_options[][100] = {//6
"A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu", "A.Mount Everest\nB.Uludag\nC.K2\nD.Makalu",
"A.USA\nB.China\nC.Russia\nD.India", "A.USA\nB.China\nC.Russia\nD.India",
"A.Missisipi River\nB.Yangtze River\nC.Amazon River\nD.The Nile River", "A.Missisipi River\nB.Yangtze River\nC.Amazon River\nD.The Nile River",
@ -257,7 +257,7 @@ void ask_questions(void) {
}; };
char aS[100] = {
char answers[100] = {
'A', 'A',
'B', 'B',
'D', 'D',
@ -271,8 +271,8 @@ void ask_questions(void) {
'B', 'B',
}; };
int* arr = randomNumber();
looping(qS, qC, aS, arr);
int* randArr = randomNumber();
looping(questions, possible_options, answers, randArr);
} }

Loading…
Cancel
Save