Thread: menu problem!!! need U R G E N T help!!!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    5

    Unhappy menu problem!!! need U R G E N T help!!!

    i want to make a menu and i am almost finished typing it. but i don't know how to return to the main menu again after an option is chosen.

    my program:

    Code:
    #include <stdio.h>
    
    void main_menu( );
    
     int main( )
    {
      
    
    main_menu();
    
      return 0;
    
    } 
    
    
    
    
    void main_menu()
    { int selection;
      
      printf( "*** ***** ***** ***** ***** ***** ***** ***\n" );  
      printf( "** * *** * *** * *** * *** * *** * *** * **\n" );  
      printf( "* *** * *** * *** * *** * *** * *** * *** *\n" );  
      printf( " ***** ***** ***** ***** ***** ***** ***** \n" );
      printf( "****          Welcome to MY PROGRM!       ****\n" );
      printf( " ***** ***** ***** ***** ***** ***** ***** \n" );
      printf( "* *** * *** * *** * *** * *** * *** * *** *\n" );
      printf( "** * *** * *** * *** * *** * *** * *** * **\n" );
      printf( "*** ***** ***** ***** ***** ***** ***** ***\n\n" );
              
      printf(" What is you name?");
      scanf("&#37;s");
      
                   
             printf("\nPlease choose one of the options below and enter its number: \n\n");
             printf(" 1) Count the total number of words\n");
             printf(" 2) Count the total number of vowels\n");
             printf(" 3) Count the total number of capital letters\n");
             printf(" 4) Reverse the text inputted\n");
             printf(" 5) Capitalize the first letters and lowercase other letters\n");
             printf(" 6) Exit\n\n");
    
      printf("Choose an option: ");
      scanf("%d", &selection);
     
      switch(selection){
        case 1:
          {
    
           /*function 1*/
          
    }
          break;
          
        case 2:
          {
    	
          /*function 2*/
    
    	
    }
          break;
        case 3:
          {
    
           /*function 3*/
            
    }
    
          break;
        case 4:
          {
    	
           /*function 4*/
    	
    }
          break;
        case 5:
          {
     
           /*function 5*/
    	
    }
    
          break;
        case 6:
          {
           int ch;
           fflush(stdin);
    	do
    	{
    	   puts("\nAre you sure you want to quit ? (Y/N)\n");
    	   ch = getc(stdin);
    	   if (ch == 'y')
    	{
    	    printf("\nThank you for using ! Byebye!\n");
    	    exit(0);
    	}
    	    else if (ch == 'n')
    	{
    	    puts("\nReturning to main menu...\n\n");
             
                main_menu();
    
                return ;
    	
    	}
    	}while(ch != 'n' || ch != 'y');
    	break;
    }
          break;
          default: 
          printf("\nInvalid selection! Program will end automatically.\n");
          break;
          
      }
    
    }
    i want to know how i can return to the main menu again without showing the following text
    Code:
     printf( "*** ***** ***** ***** ***** ***** ***** ***\n" );  
      printf( "** * *** * *** * *** * *** * *** * *** * **\n" );  
      printf( "* *** * *** * *** * *** * *** * *** * *** *\n" );  
      printf( " ***** ***** ***** ***** ***** ***** ***** \n" );
      printf( "****          Welcome to MY PROGRM!       ****\n" );
      printf( " ***** ***** ***** ***** ***** ***** ***** \n" );
      printf( "* *** * *** * *** * *** * *** * *** * *** *\n" );
      printf( "** * *** * *** * *** * *** * *** * *** * **\n" );
      printf( "*** ***** ***** ***** ***** ***** ***** ***\n\n" );
              
      printf(" What is you name?");
    but directly show the following part to the user.
    Code:
     printf("\nPlease choose one of the options below and enter its number: \n\n");
             printf(" 1) Count the total number of words\n");
             printf(" 2) Count the total number of vowels\n");
             printf(" 3) Count the total number of capital letters\n");
             printf(" 4) Reverse the text inputted\n");
             printf(" 5) Capitalize the first letters and lowercase other letters\n");
             printf(" 6) Exit\n\n");
    
      printf("Choose an option: ");
    Someone please help! i tried so many times but i still fail! =(
    please give me some examples!
    Last edited by catcat28; 11-19-2007 at 07:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. Simple Menu Problem
    By DanC in forum C++ Programming
    Replies: 4
    Last Post: 03-15-2006, 01:33 PM
  3. Problem with Mouse Over Menu!!! HELP!!!
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2006, 02:10 AM
  4. Window - Menu problem...
    By FromHolland in forum Windows Programming
    Replies: 1
    Last Post: 02-26-2004, 03:49 PM
  5. MDI and MENU Problem
    By Marc in forum Windows Programming
    Replies: 3
    Last Post: 02-21-2004, 06:59 PM