From 241235ff46a9f667fa5c10e1dd40d1bdf09e3ef6 Mon Sep 17 00:00:00 2001 From: fdlt3859 Date: Fri, 10 Feb 2023 11:24:09 +0000 Subject: [PATCH] refactoring: code reduced and made simpler --- src/main/quizproject.c | 98 ++++-------------------------------------- 1 file changed, 9 insertions(+), 89 deletions(-) diff --git a/src/main/quizproject.c b/src/main/quizproject.c index 5bd17a9..d9ec5b0 100644 --- a/src/main/quizproject.c +++ b/src/main/quizproject.c @@ -3230,110 +3230,30 @@ void v_allaboutspace(void){ } else { printf("\nYou tried... but time to study more about Space!\n\n"); } - - printf("Do you want to play again? (1 - yes, 0 - no): "); - scanf("%d", &space_replay); - - if(space_replay == 1) { - if (space_choice == 1) { - printf("Quiz Start!\n"); - printf("\nQuestion 1: What is the largest planet in our solar system?\n\n"); - printf("1. Earth\n"); - printf("2. Mars\n"); - printf("3. Jupiter\n"); - printf("4. Saturn\n"); - printf("\nEnter your answer: "); - scanf("%d", &space_answer); - if (space_answer == 3) { - printf("\nCorrect!\n"); - space_score++; - } else { - printf("\nIncorrect\n"); - } - } - printf("\nQuestion 2: What is the smallest planet in our solar system?\n\n"); - printf("1. Mercury\n"); - printf("2. Mars\n"); - printf("3. Venus\n"); - printf("4. Pluto\n"); - printf("\nEnter your answer: "); - scanf("%d", &space_answer); - if (space_answer == 1) { - printf("\nCorrect!\n"); - space_score++; - } else { - printf("\nIncorrect\n"); - } - - printf("\nQuestion 3: What is the name of the first man-made satellite to be launched into space?\n\n"); - printf("1. Sputnik 1\n"); - printf("2. Apollo 11\n"); - printf("3. Vostok 1\n"); - printf("4. Explorer 1\n"); - printf("\nEnter your answer: "); - scanf("%d", &space_answer); - if (space_answer == 1) { - printf("\nCorrect!\n"); - space_score++; - } else { - printf("\nIncorrect\n"); - } - - printf("\nQuestion 4: What is the name of the first man to walk on the Moon?\n\n"); - printf("1. Neil Armstrong\n"); - printf("2. Buzz Aldrin\n"); - printf("3. Yuri Gagarin\n"); - printf("4. Valentina Tereshkova\n"); - printf("\nEnter your answer: "); - scanf("%d", &space_answer); - if (space_answer == 1) { - printf("\nCorrect!\n"); - space_score++; - } else { - printf("\nIncorrect\n"); - } - - printf("\nQuestion 5: What is the name of the first successful interplanetary probe?\n\n"); - printf("1. Pioneer 10\n"); - printf("2. Mariner 2\n"); - printf("3. Viking 1\n"); - printf("4. Luna 1\n"); - printf("Enter your answer: "); - scanf("%d", &space_answer); - if (space_answer == 1) { - printf("\nCorrect!\n"); - space_score++; - } else { - printf("\nIncorrect\n"); - } - - printf("\nYour score is: %d\n\n", space_score); - if (space_score == 5) { - printf("\nCongratulations! You are ready to take off!\n\n"); - } else if (space_score >= 3) { - printf("\nGood job! But you need some more training before you venture into space.\n\n"); - } else { - printf("\nYou tried... but time to study more about Space!\n\n"); - } - } else{ - - } } void v_play_allaboutspace(void){ - + int space_replay; printf("*********************************************\n"); printf("Welcome to the Quiz which is all about Space!\n"); printf("*********************************************\n\n"); v_allaboutspace(); + printf("Do you want to play again? (1 - yes, 0 - no): "); + scanf("%d", &space_replay); + if(space_replay == 1) { + v_allaboutspace(); + } else{ + + } printf("*****************************************\n"); printf("Hope you enjoyed. TO INFINITY AND BEYOND!\n"); printf("*****************************************\n\n"); } + void feedbackForm(void){ int rating; char feedback[1000];