From ada602f05462c8c245722e8cdc2d8fd35781c502 Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Wed, 25 Jan 2023 21:36:45 +0000 Subject: [PATCH] Refactoring: Stores user's last name as well --- src/main/quizproject.c | 13 ++++++++----- src/main/quizproject.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index a32cbb4..0aa0dfe 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -35,10 +35,13 @@ void displayWelcomeMessage(void) { scanf("%c", &startGame); startGame = toupper(startGame); if (startGame != ' ') { - char name[100] = {0}; + char vorName[100] ={0}; + char nachName[100] ={0}; printf("\t\t Please enter your First Name \n"); - scanf("%s", name); - displayGameInstructions(name); + scanf("%s", vorName); + printf("\t\t Please enter your Surname \n"); + scanf("%s", nachName); + displayGameInstructions(vorName, nachName); } } @@ -51,10 +54,10 @@ void displayGoodLuckMessage(void) { printf("\t\t------------------------------------------\n\n"); } -void displayGameInstructions(char name[]) { +void displayGameInstructions(char vorName[], char nachName[]) { printf("\t\t------------------------------------------\n\n"); printf("\t\t------------------------------------------\n\n"); - printf("\t\t Hello %s! \n\n", name); + printf("\t\t Hello %s %s! \n\n", vorName, nachName); printf("\t\t To start this game, here are the Game Instructions\n\n"); printf("\t\t------------------------------------------\n"); printf("\t\t------------------------------------------\n\n"); diff --git a/src/main/quizproject.h b/src/main/quizproject.h index 79b3d04..0d64556 100644 --- a/src/main/quizproject.h +++ b/src/main/quizproject.h @@ -2,7 +2,7 @@ #define QUIZPROJECT_H void displayWelcomeMessage(void); -void displayGameInstructions(char name[]); +void displayGameInstructions(char vorName[], char nachName[]); void displayLifelineInstructions(void); void displayInstructions(void); void displayGoodLuckMessage(void);