please help me...

This is a discussion on please help me... within the C Programming forums, part of the General Programming Boards category; can i ask smthng?? if we going to make boxes for our program,do we need to type 'putchar()' 1000 of ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    5

    please help me...

    can i ask smthng??
    if we going to make boxes for our program,do we need to type 'putchar()' 1000 of times???

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    I have no idea. Are you trying to print a sort of menu?

  3. #3
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    You can't handle the text console very well just with standard calls, like putchar().
    Theoretically, you can print a screenfull with characters creating the look you want to get, but how big is a screenful? No standard library function will help there.
    For windows console control, you might need to check out a <conio.h> how to,
    and for unix a <curses.h>
    These are headers that contain system-specific console based input/output functions.
    But for a new programmer they can be too much to take...
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Try this:
    Code:
    Example:
    #include <stdio.h>
    
    /* define some box-drawing characters */
    #define LEFT_TOP  0xDA
    #define RIGHT_TOP 0xBF
    #define HORIZ     0xC4
    #define VERT      0xB3
    #define LEFT_BOT  0xC0
    #define RIGHT_BOT 0xD9
    
    int main(void)
    {
       char i, j;
    
       /* draw the top of the box */
       putchar(LEFT_TOP);
       for (i=0; i<10; i++)
          putchar(HORIZ);
       putchar(RIGHT_TOP);
       putchar('\n');
    
       /* draw the middle */
       for (i=0; i<4; i++)
       {
          putchar(VERT);
          for (j=0; j<10; j++)
             putchar(' ');
          putchar(VERT);
          putchar('\n');
       }
    
       /* draw the bottom */
       putchar(LEFT_BOT);
       for (i=0; i<10; i++)
          putchar(HORIZ);
       putchar(RIGHT_BOT);
       putchar('\n');
    
       return 0;
    }
    (straight out of Turbo C )

    12 putchar's will do ya!

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,915
    Why do you keep advertising Turbo C?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Aia
    Aia is offline
    Beautiful to C Aia's Avatar
    Join Date
    Jun 2007
    Posts
    124

    Talking

    Quote Originally Posted by Elysia View Post
    Why do you keep advertising Turbo C?
    A commercial? Where?
    Using the bitwise >> to fast-forward
    When the eagles are silent, the parrots begin to jabber. ~Winston Churchill

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,915
    This...
    Quote Originally Posted by Adak View Post
    (straight out of Turbo C )
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Elysia View Post
    Why do you keep advertising Turbo C?
    I have two compilers: VS 6.0 and a very old Turbo C.

    The VS is clumsy and slow. I either get help that isn't enough, or help that forces me to wade through other programming languages help, included in the suite. It's a PITA, to be kind about it.

    The Turbo C is fast, I know several of their help examples locations by heart, after all these years.

    I thought I'd give the free VS offering a try. My email server dumped it as spam. So I set it up more liberally, and went to try it again. MS won't send another copy, thank you very much.

    I wouldn't post someone else's code without giving them due credit in the post, in any case.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,915
    So... what do you need the email for again? Serial? You can download without email, so...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Feb 2008
    Posts
    5
    here the condition....
    i need to do an banking system program...
    as we know,the atm mechine appear in small box rite??
    i need to do smthng like that...

    it would be better if it can pop out...
    but how can i do it???
    by using ASCII code??

  11. #11
    uint64_t...think positive xuftugulus's Avatar
    Join Date
    Feb 2008
    Location
    Pacem
    Posts
    355
    Check out http://ascii-table.com
    The answer is you can't do it using ASCII code, you would have to use extended ASCII codes:
    Character values from 128 to 255.
    Because the actual drawn characters are system-dependent for that range, you could do a simple printout of those values, assuming you can code a for loop that prints the characters with values from 128 to 255, and choose the ones that print out nice box edges corners etc.
    Alternatively, you can use ASCII and print it like:
    Code:
    +---------------+
    |               |
    |               |
    +---------------+
    which is a nice box, and is extremely portable also.
    Code:
    ...
        goto johny_walker_red_label;
    johny_walker_blue_label: exit(-149$);
    johny_walker_red_label : exit( -22$);
    A typical example of ...cheap programming practices.

  12. #12
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Looking at what he is talking about, he is probably talking about GUI boxes, 'popping out'

    Then again, I maybe wrong

Popular pages Recent additions subscribe to a feed

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