Thread: problem w/ doubles in friend's program

  1. #16
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by mkylman View Post


    Um...what? I've really got no knowledge of this anymore, I definitely need to spend time relearning this >.<
    if user inputs something like "blablabla" scanf will not be able to convert it to int- so the string will be left in the input buffer as is.
    if you use continue and do nothing to the input buffer next iteration will try to read the same string and will fail as well

    you need to get rid of the "blablabla" string before asking user to enter something else. REad FAQ how to do it

    FAQ > How do I... (Level 2) > Flush the input buffer
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  2. #17
    Registered User
    Join Date
    Aug 2006
    Posts
    62
    Okay I get it now. Thanks a ton man, this is more useful than you know!

    MKylman

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  2. Multi Thread Program Problem
    By ZNez in forum C Programming
    Replies: 1
    Last Post: 01-03-2009, 11:10 AM
  3. I have finished my program, one problem
    By sloopy in forum C Programming
    Replies: 4
    Last Post: 11-29-2005, 02:10 AM
  4. Some Problem With My Program
    By Americano in forum C Programming
    Replies: 5
    Last Post: 10-18-2003, 01:58 AM
  5. Problem with Program not Quitting
    By Unregistered in forum Windows Programming
    Replies: 20
    Last Post: 06-11-2002, 11:06 PM