C++ Quick Help

Discussion in 'Mac Programming' started by pknz, Aug 27, 2005.

  1. pknz macrumors 68020

    pknz

    Joined:
    Mar 22, 2005
    Location:
    NZ
    #1
    C++ Programming

    How do you exit a while loop with an 'x'?
    So far I have this
    while(cin.good() && iCode!='x')

    but if I run this and enter x, it is rejected by the fact it is not numerical
    while (!cin.good() || iCode>999).

    Also after a cout, how do you clear the line, I believe it is clreol(); but where do you put this to clear the line.

    Thanks
     
  2. VanMac macrumors 6502a

    VanMac

    Joined:
    May 26, 2005
    Location:
    Rampaging Tokyo
    #2
  3. SamMiller0 macrumors member

    SamMiller0

    Joined:
    Aug 17, 2004
    Location:
    San Jose, CA
    #3
    What type of variable is iCode?

    I am not sure how to "clear the line" since that's platform specific. You can do it easily with a curses library, typically ncurses on Linux. As far as the mac, I am not sure. Someone will response hopefully.
     
  4. pknz thread starter macrumors 68020

    pknz

    Joined:
    Mar 22, 2005
    Location:
    NZ
    #4
    Thanks for yor help guys.

    The tutorial was quite informative.

    Thanks
     

Share This Page