Thread: screen formating

  1. #1
    Unregistered
    Guest

    screen formating

    Here is a stupid question. I have to do some formating for a program. With this formating i need to make a box out these symbles ----------- Depending on how big the box is the number of dashes. I can i make the box grow and shrink depending the data in the box. I can get the side to work but not the top or botom line. Is there some format function that you can just multiple the single - (dash) to the number of charactors going into the box?


    Thanks
    chris

  2. #2
    Sayeh
    Guest
    Yes, it's called a loop.

  3. #3
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Well, it all depends on your data. Of course, you'll want to use a loop and then stop and the data specification. Example:
    Code:
    char string[10];
    int numtimes, i;
    
    printf("Enter how big the box is in length: ");
    fgets(string, sizeof(string), stdin); // get string from std input
    sscanf(string, "%d", &numtimes); // put int value into numtimes
    
    for (i = 0, i < numtimes; i++)
    {
        printf("|\n");
    }
    I haven't tested the code, but logically that will work.

    --Garfield

    BTW If you really want to get into visual programming, learn to program Windows (preferable with petzold).
    1978 Silver Anniversary Corvette

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. formating screen information
    By freeman_peterso in forum C Programming
    Replies: 5
    Last Post: 07-10-2003, 06:48 PM