Thread: Im Frustrated!

  1. #16
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    sigh, once again:
    PHP Code:
    #include <iostream.h>
    #include <stdlib.h>

    int main()
    {
        
    cout<<"Hi"<<endl;
        
    system("PAUSE");
        
    system("CLS");
        
    cout<<"Hi again"<<endl;
        
    system("PAUSE");
        return 
    0;

    I tested this it worked. I even used more system's

  2. #17
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: Im Frustrated!

    Originally posted by Powerfull Army
    Thank you but theres still a problem:
    consider this snippet:
    cout << "Hi!\n";
    getchar();
    system("CLS");
    cout << "Hi again!\n";
    You would think it say 'Hi!',then wait for a carriage return/line-feed,then clear screen,and say 'Hi again!',but it doesn't.It waits for a carriage return/line-feed,then clears screen and prints
    Hi!
    Hi again!
    And please tell me c++ has a way to clear the screen on its own!
    This failed because the output buffer wans't flushed in time. Try using endl instead of \n. Also, should you c++ people be using cin.get() instead of getchar()?!
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    And please tell me c++ has a way to clear the screen on its own!
    Nope. This has already been explained. CLEARING THE SCREEN IS SYSTEM SPECIFIC!

    This means that depending on your operating system, it is handled different. C++ is a LANGUAGE, not a group of libraries.

    You're asking "How do I say the German word for cat in English?" ... It's two different things.

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

  4. #19
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >why have you made such a big deal about it in previous posts?
    >Just asking...
    Probably because I was talking about C at the time. In C when you don't return anything from main, the value that gets returns is undefined, C++ fixes that by defaulting to a value of successful completion (usually 0) if there is no return value.

    I could have possibly confused myself and thought C while talking about C++ because my compiler will complain about no return value with C++ as well. This is why my C++ examples will all have the return statement. It's not required, but I've gotten into the habit.

    -Prelude
    My best code is written with the delete key.

  5. #20
    Registered User
    Join Date
    Jan 2002
    Posts
    559
    Thanks for the explanation, Prelude.
    Powerfull Army, I was just kidding, that's why I included the smiley. It does work though, at least if your colums/lines match up with the values.
    Truth is a malleable commodity - Dick Cheney

  6. #21
    Registered User snowy101's Avatar
    Join Date
    May 2002
    Posts
    22

    got an idea

    ok stick one clrscr(); at the top of it before hi! and then one after the getch(); and that should work 100% properly if it doesn't ill give ou another suggestion that should work.
    Simple Programming

    :::: Error Message != A Smile ::::

  7. #22
    Unregistered
    Guest
    Why not just write a routine to clear the screen in assembly? It should be easy enought to look up the right interrupt in Ralph Brown's interrupt list.

  8. #23
    Registered User foniks munkee's Avatar
    Join Date
    Nov 2001
    Posts
    343
    Or use a library like curses that at least exists for a number of platforms. It is likely the closest you will get to portability in this respect.
    "Queen and huntress, chaste and fair,
    Now the sun is laid to sleep,
    Seated in thy silver chair,
    State in wonted manner keep."

  9. #24
    Registered User
    Join Date
    Aug 2001
    Posts
    403
    I know people make full-blown applications with c++ all the time so theres got to be a simple way to clear the screen
    Most Full blown apps aren't on the command line, they are graphical in some way. C++ is a core language, as others have pointed out, so writing specific stuff will always be done in more than one line of code. If you want to write a windows app it will be many lines just to set up your window there is no MagicShowWindow. As you learn C++ you'll find places that there are very common tasks that need to be performed.. that is what functions are for. I learned all this from experience.. I remember 2 years ago when I picked up my first book on C learned all the basic syntax in a few days, and I was like "Oh, that's nice.. how do I make graphics?"

    Don't get frustrated if you have to download a library or learn some new functions or even write some of your own, that is a major part of programming, and you'll get used to it

  10. #25
    Registered User moonwalker's Avatar
    Join Date
    Jul 2002
    Posts
    282

    Re: Re: Im Frustrated!

    Originally posted by salvelinus

    It sure does. Try this:
    PHP Code:
    for (int i 025i++)
    {
       for (
    int j 080j++)
          
    cout << "  ";

    That should do it.
    That's a nice way of doing it
    But it may not work if the screen is set in a different modes
    (right click on the console window's "button" on task
    bar - properties - fonts.... see ? there're many options there)
    Last edited by moonwalker; 08-21-2002 at 08:00 PM.

  11. #26
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    Originally posted by Unregistered
    Why not just write a routine to clear the screen in assembly? It should be easy enought to look up the right interrupt in Ralph Brown's interrupt list.
    god your disgusting. only extreme nerds do that

  12. #27
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    A) Xterria, get a freaking life.

    B) Interrupts are not allowed in win2k I believe (not too sure b/c I don't have it). So even that wouldn't be portable.

    Edit: fixed typo

  13. #28
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    GRRR! A clear screen question.

    * C'mon boys, get your flame-cannons ready. Its huntin' season... *

  14. #29
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > Its huntin' season... *

    How about not - this thread's 2 months old.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. frustrated bout char array
    By royuco77 in forum C++ Programming
    Replies: 2
    Last Post: 07-11-2005, 09:10 AM
  2. Getting frustrated
    By kippwinger in forum C++ Programming
    Replies: 17
    Last Post: 07-02-2003, 03:55 PM
  3. A Bit Frustrated....
    By DirX in forum C++ Programming
    Replies: 3
    Last Post: 04-14-2003, 10:29 PM
  4. so confused and frustrated
    By ct26torr in forum C Programming
    Replies: 2
    Last Post: 02-13-2003, 10:40 PM
  5. so frustrated!!!!
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 11-28-2001, 06:44 PM