Thread: How to make a Rectangle

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    India
    Posts
    14

    How to make a Rectangle

    Hi I just want to make a Rectangle in C using graphics instead of doing like this:
    Code:
    void box_ma()
    {
    int c=60,r=1;
    gotoxy(60,1);
    printf("%c",218); 	// ASCII Code of ("Ú") is 218
    
    for(r=2;r<=17;r++)
    {
      gotoxy(c,r);
      printf("%c",219); 	// ASCII Code of ("³" is 179 & "Û" is 219)
    }
    gotoxy(60,17);
    printf("%c",192); 	// ASCII Code of ("À") is 192
    
    for(c=61;c<=76;c++)
    {
      gotoxy(c,17);
      printf("%c",196); 	// ASCII Code of ("Ä") is 196
    }
    gotoxy(77,17);
    printf("%c",217); 	// ASCII Code of ("Ù") is 217
    
    for(r=16;r>=2;r--)
    {
      gotoxy(77,r);
      printf("%c",219); 	// ASCII Code of ("³" is 179 & "Û" is 219)
    }
    gotoxy(77,1);
    printf("%c",191); 	// ASCII Code of ("¿") is 191
    
    for(c=76;c>=61;c--)
    {
      gotoxy(c,r);
      printf("%c",196); 	// ASCII Code of ("Ä") is 196
    }
    }
    Please help me if possible

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    Can get OS dependant.

    Windows: FillConsoleOutputCharacter(..)
    NCURSES: wborder(..)

    Edit: I thought you wanted a better way to do it in the console, jesus, nevermind.
    Last edited by Tonto; 02-02-2006 at 01:52 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Hi I just want to make a Rectangle in C using graphics instead of doing like this:
    State your OS and compiler then.

  4. #4
    Registered User
    Join Date
    Mar 2005
    Location
    India
    Posts
    14

    To create a rectangle in C

    Hi
    I am using Turbo C. I am making a programme for GK, but i need some rectangle to present the questions, answers and options respectively.

    please help to complete the task.

    Thanx

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So make two sub-functions called
    - HorizontalLine
    - VerticalLine

    Then your box function becomes just 4 lines long!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  2. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 04:19 AM
  3. make all rule
    By duffy in forum C Programming
    Replies: 9
    Last Post: 09-11-2003, 01:05 PM
  4. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  5. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM