Thread: Problem with cin. Please help me.

  1. #16
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    Yes I just realised that must have been the problem.

    Since I'm using the cin to pause the program -that is causing the problems. In most cases this wouldn't matter but in this particular case it does.

    However, when I use getch(); to pause the program it works.
    Although, secondly I noticed if I enter:

    Code:
    123abc23
    
    the output is>> 
    
    the integer you entered was: 123
    shouldn't this return an error?

  2. #17
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >shouldn't this return an error?
    Why should it? Just because you find that behavior vexing in this one case doesn't mean it's an error. In fact, if it were flagged as an error, we all would have so much trouble working with streams that they wouldn't be practical.
    My best code is written with the delete key.

  3. #18
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    Sorry you misunderstood me. I don't mean it's wrong, I just mean the input is invalid. A small point nothing big. But now I understand why my particular program wasn't compiling and running as expected.

    Thanks for explaining hk_mp5kpdw


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  2. Input File HELP, weird problem
    By gravity-1 in forum C++ Programming
    Replies: 5
    Last Post: 03-29-2005, 08:43 PM
  3. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM
  4. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 05:18 AM
  5. Problem with cin
    By ErionD in forum C++ Programming
    Replies: 3
    Last Post: 02-19-2002, 11:27 AM