O.K. this is an abstraction, so it doesn't exactly extrapolate to your exact program, but look at these two functions. Now unless your saying that the defrag.exe won't allow you to return to the console screen(if so, seek other's help), then this should work.
It appears to me you have not made each menu it's own function and I think you'd benifit to do so...
PHP Code:
void main_menu(void)
{
int main_menu_choice=0;
printf("1)Do defrag/scandisc/other operations \n"
"2)Set up user info \n"
"3)Search Database \n"
"4)Exit \n\n" );
scanf("%d", &main_menu_choice);
switch(main_menu_choice)
{
case 1: sub_menu1();
break;
case 2: sub_menu2();
break;
case 3: sub_menu4();
break;
default: exit(1);
}
} //End of main_menu function
void sub_menu1(void)
{
int sub_menu_choice=0;
printf("1)Do defrag \n"
"2)Do scandisc \n"
"3)Exit \n\n" );
scanf("%d", &sub_menu_choice);
switch(sub_menu_choice)
{
case 1: system("c:\\windows\\defrag.exe");
main_menu(); //<----should return you to the main menu
break;
case 2: system("c:\\windows\\scandisc.exe");
main_menu();
break;
default: exit(1);
}
} //End of sub_menu function
In other words, getting to a menu is as simple as calling it by the function which encapsulates it. Note also that the users choice variable is declared within the function, not in main. Note also that after encapsulating all of your menus, main looks more like this:
PHP Code:
#include <stdio.h>
#include <stdlib.h>
//function prototypes go here
int main(
main_menu();
printf("Goodbye!");
return 0;
}
/// define functions here
This of course simplifies things since calling "main_menu()" you are also providing the means to get to the other menus specified in it's "switch/case" statement...
I hope that helps a little.