Why does cin>> go into an infinite loop

This is a discussion on Why does cin>> go into an infinite loop within the C++ Programming forums, part of the General Programming Boards category; given Code: int x; cin>>x; When prompted for x, if the user enters a character, it sends the program into ...

  1. #1
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    Why does cin>> go into an infinite loop

    given
    Code:
    int x;
    cin>>x;
    When prompted for x, if the user enters a character, it sends the program into an infinite loop. How can I correct this?
    I AM WINNER!!!1!111oneoneomne

  2. #2

  3. #3
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    Wow.. that page has a ton of stuff in addition to what I need. thanks
    I AM WINNER!!!1!111oneoneomne

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2009, 11:24 PM
  2. Cosine fucntion and infinite loop.
    By youareafever in forum C Programming
    Replies: 2
    Last Post: 11-07-2008, 03:45 AM
  3. Infinite Loop with GetAsyncKeyState
    By guitarist809 in forum Windows Programming
    Replies: 1
    Last Post: 04-18-2008, 12:09 PM
  4. Switch statement = infinite loop
    By Lucid003 in forum C++ Programming
    Replies: 10
    Last Post: 10-10-2005, 12:46 AM
  5. stays in loop, but it's not an infinite loop (C++)
    By Berticus in forum C++ Programming
    Replies: 8
    Last Post: 07-19-2005, 11:17 AM

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