I wanted to make a program that asks the user questions and then the user selects an answer and then the program returns back to the original directory of questions. for example:
What's your favorite color? 1. Blue 2. Green 3. Yellow
then the user selects say "2"
then I want it to return back to
What's your favorite color? 1. Blue 2. Green 3. Yellow
I have the code worked out to handle asking, selecting answers to the questions. I just need help returning back to the original question so the user can answer it again if they would like. thanks people!
#include <stdio.h>
int main (void)
{
printf("\nIntroducing Space\n");
printf("Brought to you in part by Free Time\n\n\n");
while(1) {
int space;
int subspace1;
int subspace2;
printf("What would you like to do in Space?\n");
printf("\nDIRECTORY\n\n");
printf("1. What is space?\n");
printf("2. Tell me how cool I am\n");
printf("Enter the number to your desired space\n");
scanf("%i", &space);
if (space == 2){
printf("Although I have never met you, anyone in space would be considered cool to the average eye. I mean lets be real, its space.\n\n");
printf("Do you have any interesting hobbies or tidbits about yourself?\n\n");
printf("1. I can play the flute blindfolded\n");
printf("2. I can eat twelve pounds of salt water taffy in one sitting\n");
printf("3. My uncle drives an RV\n");
scanf("%i", &subspace2);
if (subspace2 == 1) {
printf("\n The flute huh? You're somethin' else\n");
}
if (subspace2 == 2) {
printf("\n But let's be honest who likes salt water taffy these days anyway?\n");
}
if (subspace2 == 3) {
printf("\n An RV? Now adays they call that 'homeless' but hey whatever floats your boat chief\n");
}
}
}
return 0;
}
I feel like this is where I need some sort of return statement that brings me back to my original question "What would you like to do in space" so the user can ask another question.