From 4fae150e29371b02c96343dd8e7064c302e066e2 Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Sat, 28 Jan 2023 14:55:18 +0000 Subject: [PATCH] Added Start Up Message and minor fixes to QuizGame --- src/main/quizproject.c | 54 +++++++++++++++++++++++------------------- src/main/quizproject.h | 2 +- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 5c0a64f..c4e69eb 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -26,25 +26,7 @@ int* randomNumber() { } void displayWelcomeMessage(void) { - printf("\t\t------------------------------------------\n\n"); - printf("\t\t------------------------------------------\n\n"); - printf("\t\t Welcome to The Quiz \n\n"); - printf("\t\t------------------------------------------\n"); - printf("\t\t------------------------------------------\n\n"); - 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 nachName[100] ={0}; - printf("\t\t Please enter your First Name \n"); - scanf("%s", vorName); - printf("\t\t Please enter your Surname \n"); - scanf("%s", nachName); - displayGameInstructions(vorName, nachName); - } - + displayGameInstructions(); } void displayGoodLuckMessage(void) { @@ -55,10 +37,10 @@ void displayGoodLuckMessage(void) { printf("\t\t------------------------------------------\n\n"); } -void displayGameInstructions(char vorName[], char nachName[]) { - printf("\t\t------------------------------------------\n\n"); +void displayGameInstructions(void) { + printf("\t\t------------------------------------------\n"); + printf("\t\t Welcome to Quiz Game!\n\n"); printf("\t\t------------------------------------------\n\n"); - printf("\t\t Hello %s %s! \n\n", vorName, nachName); printf("\t\t To start this game, here are the Instructions\n\n"); printf("\t\t------------------------------------------\n"); printf("\t\t------------------------------------------\n\n"); @@ -304,7 +286,7 @@ void ask_hard_questions(void) { int *lessFive = randomNumber(); int arr[5]; int p = 0; - for(int i = 0; i < 11; i++){ + for(int i = 0; i < 13; i++){ if(lessFive[i] < 5){ arr[p] = lessFive[i]; p++; @@ -441,7 +423,7 @@ void displayThankYouMessage(void) { void play_quizgame(void){ displayInstructions(); - printf(">>Press 's' and Enter start the Game<<\n"); + printf(">>Press 's' and Enter to start the Game<<\n"); char var, var1 = 's'; getchar(); while(var != var1) { @@ -467,6 +449,30 @@ void play_game3() { int main() { int choice; + printf("Welcome to the Game Menu!\n"); + printf("\t\t----------------------------\n\n"); + printf("\t\t----------------------------\n\n"); + printf("\t\t Welcome! \n\n"); + printf("\t\t----------------------------\n"); + printf("\t\t----------------------------\n\n"); + printf("\t\tPress 'Enter' to join the Game \n"); + char joinGame; + scanf("%c", &joinGame); + joinGame = toupper(joinGame); + if (joinGame != ' ') { + char vorName[100] ={0}; + char nachName[100] ={0}; + printf("\t\tPlease enter your First Name \n"); + scanf("%s", vorName); + printf("\t\tPlease enter your Surname \n"); + scanf("%s", nachName); + printf("\t\t------------------------------------------\n\n"); + printf("\t\t------------------------------------------\n\n"); + printf("\t\t Hello %s %s! \n\n", vorName, nachName); + printf("\t\t------------------------------------------\n\n"); + printf("\t\t------------------------------------------\n\n"); + printf("\n\nPlease choose one of the number options from below\n\n"); + } printf("Welcome to the Game Menu!\n"); printf("1. QuizGame\n"); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 8a2964e..ba9f1a6 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -5,7 +5,7 @@ void play_quizgame(void); void play_factorlie(void); void play_game3(void); void displayWelcomeMessage(void); -void displayGameInstructions(char vorName[], char nachName[]); +void displayGameInstructions(void); void displayLifelineInstructions(void); void displayInstructions(void); void displayGoodLuckMessage(void);