Browse Source

Added Start Up Message and minor fixes to QuizGame

main
fdlt3859 2 years ago
parent
commit
4fae150e29
  1. 54
      src/main/quizproject.c
  2. 2
      src/main/quizproject.h

54
src/main/quizproject.c

@ -26,25 +26,7 @@ int* randomNumber() {
} }
void displayWelcomeMessage(void) { 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) { void displayGoodLuckMessage(void) {
@ -55,10 +37,10 @@ void displayGoodLuckMessage(void) {
printf("\t\t------------------------------------------\n\n"); 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------------------------------------------\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 To start this game, here are the Instructions\n\n");
printf("\t\t------------------------------------------\n"); printf("\t\t------------------------------------------\n");
printf("\t\t------------------------------------------\n\n"); printf("\t\t------------------------------------------\n\n");
@ -304,7 +286,7 @@ void ask_hard_questions(void) {
int *lessFive = randomNumber(); int *lessFive = randomNumber();
int arr[5]; int arr[5];
int p = 0; int p = 0;
for(int i = 0; i < 11; i++){
for(int i = 0; i < 13; i++){
if(lessFive[i] < 5){ if(lessFive[i] < 5){
arr[p] = lessFive[i]; arr[p] = lessFive[i];
p++; p++;
@ -441,7 +423,7 @@ void displayThankYouMessage(void) {
void play_quizgame(void){ void play_quizgame(void){
displayInstructions(); displayInstructions();
printf(">>Press 's' and Enter start the Game<<\n");
printf(">>Press 's' and Enter to start the Game<<\n");
char var, var1 = 's'; char var, var1 = 's';
getchar(); getchar();
while(var != var1) { while(var != var1) {
@ -467,6 +449,30 @@ void play_game3() {
int main() { int main() {
int choice; 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("Welcome to the Game Menu!\n");
printf("1. QuizGame\n"); printf("1. QuizGame\n");

2
src/main/quizproject.h

@ -5,7 +5,7 @@ void play_quizgame(void);
void play_factorlie(void); void play_factorlie(void);
void play_game3(void); void play_game3(void);
void displayWelcomeMessage(void); void displayWelcomeMessage(void);
void displayGameInstructions(char vorName[], char nachName[]);
void displayGameInstructions(void);
void displayLifelineInstructions(void); void displayLifelineInstructions(void);
void displayInstructions(void); void displayInstructions(void);
void displayGoodLuckMessage(void); void displayGoodLuckMessage(void);

Loading…
Cancel
Save