Browse Source

Refactoring: Stores user's last name as well

main
fdlt3859 2 years ago
parent
commit
ada602f054
  1. 13
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

13
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");

2
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);

Loading…
Cancel
Save