menu printout

This is a discussion on menu printout within the C Programming forums, part of the General Programming Boards category; well, the input i'm supposed to get is ********************* * MENU * * * * 1. ADD * * 2. ...

  1. #1
    yokk
    Guest

    menu printout

    well, the input i'm supposed to get is

    *********************
    * MENU *
    * *
    * 1. ADD *
    * 2. SUBTRACT *
    * 3. MULTIPLY *
    * 4. DIVIDE *
    * 5. QUIT *
    * *
    *********************

    this. well, i can print those box thing, but..
    i don't know how to put those text menu things IN the box.
    could you help me out on this problem?

    here is coding for the box thing.
    please tell me how to put those text IN the box..

    Code:
    #include<stdio.h>
    
    void menu();
    int		
    
    int main() 
    {
    	int i,j,k;
    
    	for(i = 0; i <= 24; i++ ) 
    	 	printf("*");
    	for(j = 0; j <= 7; j++)
    		printf("\n*\t\t\t*");
    	printf("\n");
    	for(k = 0; k <= 24; k++)
    		printf("*");
    	printf("\n\n");

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    you can try something like this

    Code:
    #include <stdio.h>
    #define QUIT 5
    
    int menu( void );
    int addition( void );
    
    int main() 
    {
    	int choice = 0;
    	while ( choice != QUIT )
    	{
    		choice = menu();
    	
    		if ( choice == 1 )		
    			addition();
    		/* etc etc */
    	}
    	printf( "Exiting\n" );
    	
    	return 0;
    }
    
    int addition( void )
    {
     /* do addition function */
    }
    
    
    int menu( void )
    {
    	int option = 0;
    
    	do 
    	{
    		printf( "************************\n" );
    		printf( "* MENU *		*\n" );
    		printf( "* *			*\n" );
    		printf( "* 1. ADD 		*\n" );
    		printf( "* 2. SUBTRACT 		*\n" );
    		printf( "* 3. MULTIPLY 		*\n" );
    		printf( "* 4. DIVIDE 		*\n" );
    		printf( "* 5. QUIT 		*\n" );
    		printf( "* *			*\n" );
    		printf( "************************\n" );
    		printf( "Enter option: " );
    		scanf( "%d", &option );
    	}
    	while ( option < 1 || option > 5 );
    
    	return option;
    }
    you can finish it off i think..
    hope it helps, gl.
    there are only 10 people in the world, those who know binary and those who dont

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    puts("
    *********************
    * MENU *
    * *
    * 1. ADD *
    * 2. SUBTRACT *
    * 3. MULTIPLY *
    * 4. DIVIDE *
    * 5. QUIT *
    * *
    *********************
    ");
    There ya go.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    Heh, you don't need start to looping to print-out this menu, you'll need looping for better things, not this

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21