Browse Source

Created a Menu to add and run different programs

main
fdlt3859 2 years ago
parent
commit
afaca42b31
  1. 45
      src/main/quizproject.c
  2. 3
      src/main/quizproject.h

45
src/main/quizproject.c

@ -4,6 +4,7 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include "quizproject.h" #include "quizproject.h"
char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'}; char answers[NUM_QUESTIONS] = {'B', 'A', 'A','B','A'};
int* randomNumber() { int* randomNumber() {
@ -437,7 +438,7 @@ void displayThankYouMessage(void) {
printf("*******************************\n\n"); printf("*******************************\n\n");
} }
int main(){
void play_quizgame(void){
displayInstructions(); displayInstructions();
printf(">>Press 's' and Enter start the Game<<\n"); printf(">>Press 's' and Enter start the Game<<\n");
@ -452,7 +453,47 @@ if (score > 2){
ask_hard_questions(); ask_hard_questions();
} }
displayThankYouMessage(); displayThankYouMessage();
return 0;
}
void play_factorlie() {
printf("Playing game 2...\n");
// code for game 2 goes here
}
void play_game3() {
printf("Playing game 3...\n");
// code for game 3 goes here
}
int main() {
int choice;
printf("Welcome to the Game Menu!\n");
printf("1. QuizGame\n");
printf("2. Fact or Lie?\n");
printf("3. Game 3\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch(choice) {
case 1:
play_quizgame();
break;
case 2:
play_factorlie();
break;
case 3:
play_game3();
break;
case 4:
printf("Exiting the Game Menu...\n");
break;
default:
printf("Invalid choice!\n");
}
return 0;
} }

3
src/main/quizproject.h

@ -1,6 +1,9 @@
#ifndef QUIZPROJECT_H #ifndef QUIZPROJECT_H
#define QUIZPROJECT_H #define QUIZPROJECT_H
void play_quizgame(void);
void play_factorlie(void);
void play_game3(void);
void displayWelcomeMessage(void); void displayWelcomeMessage(void);
void displayGameInstructions(char vorName[], char nachName[]); void displayGameInstructions(char vorName[], char nachName[]);
void displayLifelineInstructions(void); void displayLifelineInstructions(void);

Loading…
Cancel
Save