Code:int screen3 (initial_amount) { //Variable int temperature; int light_intensity; int added_amount; int days_of_idle; int function; int main_menu; temperature = 30; light_intensity = 2500; system ("cls"); printf("(1) Adjust the temperature of the culture. \n"); printf(" (2) Adjust the light intensity of the culture.\n"); printf("(3) Add new amount of Lactobacillus into\n"); printf(" the culture.\n"); printf("(4) Add random amount of Lactobacillus into\n"); printf(" the culture.\n"); printf("(5) Let the culture be idle for one day. \n"); printf("(6) Let the culture be idle for several days\n"); printf(" (maximum of 5 days)\n"); printf ("Current amount of Lactobacillus: %d.\n",initial_amount); printf ("Current culture temperature: %d degree.\n",temperature); printf ("Current light intensity: %d.\n\n\n",light_intensity); printf ("Please select a function:"); scanf ("%d",&function); switch (function) { case 1: screen4 (temperature,initial_amount,light_intensity); break; case 2: screen5 (temperature,initial_amount,light_intensity); break; case 3: screen6 (temperature,initial_amount,light_intensity); break; case 4: screen7 (temperature,initial_amount,light_intensity); break; case 5: screen8 (temperature,initial_amount,light_intensity); break; case 6: screen9 (temperature,initial_amount,light_intensity); break; default: printf ("Invalid Input, Only 1,2,3,4,5,6,7 is selectable.\n"); printf ("Please reselect a function:"); scanf ("%d",&function); break; } }
My problem is how to I loop my default? I want the program to repeat if the user enter the function not equal to 1 to 7...
Thanks for the help...