Browse Source

Added 1stquestion and quiz works (v_AllAboutSpace)

main
fdlt3859 2 years ago
parent
commit
c70ab5e316
  1. 23
      src/main/quizproject.c

23
src/main/quizproject.c

@ -2917,7 +2917,9 @@ void v_play_horoscope(void) {
void v_allaboutspace(void){ void v_allaboutspace(void){
char spacename[20]; char spacename[20];
int spacechoice;
int space_choice;
int space_score = 0;
int space_answer;
printf("\nEnter your Astronaut name: \n"); printf("\nEnter your Astronaut name: \n");
scanf("%s", spacename); scanf("%s", spacename);
printf("\nHello, Commander %s! Pleased to have you onboard.\n\n", spacename); printf("\nHello, Commander %s! Pleased to have you onboard.\n\n", spacename);
@ -2925,7 +2927,24 @@ void v_allaboutspace(void){
printf("1. Start the Quiz!\n"); printf("1. Start the Quiz!\n");
printf("2. Quit\n"); printf("2. Quit\n");
printf("Enter your choice: "); printf("Enter your choice: ");
scanf("%d", &spacechoice);
scanf("%d", &space_choice);
if (space_choice == 1) {
printf("Quiz Start!\n");
printf("Question 1: What is the largest planet in our solar system?\n");
printf("1. Earth\n");
printf("2. Mars\n");
printf("3. Jupiter\n");
printf("4. Saturn\n");
printf("Enter your answer: ");
scanf("%d", &space_answer);
if (space_answer == 3) {
printf("Correct!\n");
space_score++;
} else {
printf("Incorrect\n");
}
}
} }

Loading…
Cancel
Save