Thread: Quick Question

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    2

    Quick Question

    I am using Dev C++ and I am trying to keep program kept open after I run it. I put cin.get(); right where I am supposed to but when I run it, it does not stay open. It worked one time, but now it is not working. Why?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Hard to tell if you don't post your code. If you have conio.h, you could use getch() instead.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    2
    Oh yeah i forgot about that. Getch() worked. Thanks, it was probably a dumb question.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>It worked one time, but now it is not working. Why?
    Probably due to leftover data in the input buffer. Did you >> in a number by any chance? Maybe you need to .ignore() some data to clear the buffer.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM