Thread: short question on c++

  1. #1
    Registered User
    Join Date
    May 2005

    short question on c++

    hello all, ive been checking out this site for a bit now and am quite impressed by the feedback noobs get.

    which is good because this is as noob a question as there is. ive done a few tutorials and believe that i know the basics and have decided to write my own program and continue learning from there.

    ok, im attempting to write a short iq test however im stuck at the very beginning of the program. the problem is that i would like to add this: cout << "Please press enter to begin test. " << endl; however i do not know how to get rid of the default press enter to continue (which then quits the program and goes back to C++.

    ive been searching for the answer for a bit now but i have not had any luck finding a solution.

    thanks in advance

  2. #2
    Registered User
    Join Date
    Jun 2004
    cout << "Please press enter to begin test. " << endl;
    this simply prints that message to the console with a newline.
    It doesn't require you to press enter.. yet you're probably using MS VC++6, that, when running apps from a workspace, the spawning process calls pause after your app exited.

    or you have a getchar(), getch(), cin.get().. whatever, that it stoping your program.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well the first step is to post the code you tried, along with saying which operating system and compiler you're using.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Northern Virginia/Washington DC Metropolitan Area
    Like xErath said, it sounds like you're probably running your code from within the IDE where a nice "pause" is automatically added for your benefit so you can see any final output your program may have generated before the window disappears. Run your program outside of the IDE environment and you won't have that problem.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  5. #5
    Registered User
    Join Date
    May 2005
    ok, i guess it is because im running it in ide. thanks for your answers.

    one more question, is there a site you guys know of that has some sample beginner/amateur programs that i could sample to see how they work?


  6. #6
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    If u want to see some sample programs, look around on this site. You should go to the source code section, or the snippets section. The programs there usually contain comments and such that should help you understand how the program works. Or just look at different threads on this site, one of them is bound to contain source code.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!
    Share your experiences with us now!

    "We will game forever!"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. int and unsignd short
    By a0161 in forum C Programming
    Replies: 2
    Last Post: 11-11-2008, 04:14 AM
  2. Exam Question - Possible Mistake?
    By Richie T in forum C++ Programming
    Replies: 15
    Last Post: 05-08-2006, 03:44 PM
  3. Simple Short Class Question
    By Travis Dane in forum C++ Programming
    Replies: 2
    Last Post: 12-24-2002, 07:12 PM
  4. traversal of tree (short question)
    By mackol in forum C Programming
    Replies: 5
    Last Post: 11-25-2002, 08:41 AM
  5. Replies: 1
    Last Post: 01-23-2002, 03:34 AM