Browse Source

refactoring: reorganizing variables

main
fdlt3859 2 years ago
parent
commit
5a2aa71e13
  1. 18
      src/main/quizproject.c
  2. 29
      src/main/quizproject.h

18
src/main/quizproject.c

@ -1229,7 +1229,7 @@ void v_factorlie(void){
} }
void play_factorlie() {
void v_play_factorlie() {
printf("**********************\n"); printf("**********************\n");
printf("Playing Fact or Lie!\n"); printf("Playing Fact or Lie!\n");
printf("**********************\n"); printf("**********************\n");
@ -1460,7 +1460,7 @@ void play_milliongame() {
// code for game 3 goes here // code for game 3 goes here
} }
void v_guessingGame(void){
void v_guessTheNumber(void){
int secret_number, guess; int secret_number, guess;
srand(time(NULL)); srand(time(NULL));
secret_number = rand() % 100 + 1; secret_number = rand() % 100 + 1;
@ -1480,11 +1480,11 @@ void v_guessingGame(void){
} }
} }
void play_guessingGame() {
void v_play_guessTheNumber() {
printf("*************************\n"); printf("*************************\n");
printf("Playing Guess the Number!\n"); printf("Playing Guess the Number!\n");
printf("*************************\n\n"); printf("*************************\n\n");
v_guessingGame();
v_guessTheNumber();
printf("****************************************\n"); printf("****************************************\n");
printf("Thank you for playing Guess the Number!\n"); printf("Thank you for playing Guess the Number!\n");
printf("****************************************\n"); printf("****************************************\n");
@ -1502,7 +1502,7 @@ void v_guessTheWord(char word[], char guessed[]) {
printf("\n"); printf("\n");
} }
void play_guessTheWord() {
void v_play_guessTheWord() {
char word[] = "Fulda"; char word[] = "Fulda";
char guessed[MAX_WORD_LENGTH] = {0}; char guessed[MAX_WORD_LENGTH] = {0};
int lives = MAX_LIVES; int lives = MAX_LIVES;
@ -3269,7 +3269,7 @@ int main(int argc, char *argv[]) {
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 2: case 2:
play_factorlie();
v_play_factorlie();
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 3: case 3:
@ -3277,11 +3277,11 @@ int main(int argc, char *argv[]) {
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 4: case 4:
play_guessingGame();
v_play_guessTheNumber();
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 5: case 5:
play_guessTheWord();
v_play_guessTheWord();
jump_to_menu = 1; jump_to_menu = 1;
break; break;
case 6: case 6:
@ -3352,7 +3352,7 @@ int main(int argc, char *argv[]) {
} }
if (jump_to_menu) { if (jump_to_menu) {
jump_to_menu = 0; jump_to_menu = 0;
printf("\nType any key and press enter to jump back to the menu.\n");
printf("\nType any key and press enter to jump back to the Main Menu.\n");
char jump_key; char jump_key;
scanf(" %c", &jump_key); scanf(" %c", &jump_key);
jump_key = toupper(jump_key); jump_key = toupper(jump_key);

29
src/main/quizproject.h

@ -2,10 +2,7 @@
#define QUIZPROJECT_H #define QUIZPROJECT_H
void play_quizgame(void); void play_quizgame(void);
void play_factorlie(void);
void play_milliongame(void); void play_milliongame(void);
void play_guessingGame(void);
void play_guessTheWord(void);
void displayWelcomeMessage(void); void displayWelcomeMessage(void);
void displayGameInstructions(void); void displayGameInstructions(void);
void displayLifelineInstructions(void); void displayLifelineInstructions(void);
@ -25,19 +22,33 @@ int* randomNumber();
void hintForHardQuestions(int); void hintForHardQuestions(int);
void feedbackForm(void); void feedbackForm(void);
void displayCredits(void); void displayCredits(void);
void v_factorlie(void);
void v_guessingGame(void);
void v_guessTheWord(char word[], char guessed[]);
void progress_bar(int percentage); void progress_bar(int percentage);
void v_progress_bar(int argc, char *argv[]); void v_progress_bar(int argc, char *argv[]);
void million_instructions();
void million_exit(int million_a);
//Header Fact or Lie
void v_factorlie(void);
void v_play_factorlie(void);
//Header Guess The Number
void v_guessTheNumber(void);
void v_play_guessTheNumber(void);
//Header Guess The Word
void v_guessTheWord(char word[], char guessed[]);
void v_play_guessTheWord(void);
//Header Rock Paper Scissors
void v_play_rockpapersciss(void); void v_play_rockpapersciss(void);
//Header Horoscope Game
void v_horoscope(int day, int month); void v_horoscope(int day, int month);
void v_play_horoscope(void); void v_play_horoscope(void);
//Header AllAboutSpace
void v_allaboutspace(void); void v_allaboutspace(void);
void v_play_allaboutspace(void); void v_play_allaboutspace(void);
void million_instructions();
void million_exit(int million_a);
//------Math_quiz_header_begin----- //------Math_quiz_header_begin-----

Loading…
Cancel
Save