Results 1 to 5 of 5
  1. #1
    absoltrainer2 is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default Not sure exactly what to use.

    I'm drawing a complete blank here. I should know this, but I think I'm looking up the wrong thing.

    Basically I'm inputing a varible, be is a int or a String, but basically I need to add some code that will activate if I input something that I'm not suppose to or input something incorrectly. In other words I am handling illegal menu selection or input data without terminating the program.

    I'm not asking for exact code, and thus why I didn't post any, but just what I need to look up. If that makes any sense

    Any help?

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Quote Originally Posted by absoltrainer2 View Post

    Any help?
    Plenty. I guess you're talking about input from the console. What comes to mind first is a do while loop until the input is valid. Does that help?
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by absoltrainer2 View Post
    I'm drawing a complete blank here. I should know this, but I think I'm looking up the wrong thing.

    Basically I'm inputing a varible, be is a int or a String, but basically I need to add some code that will activate if I input something that I'm not suppose to or input something incorrectly. In other words I am handling illegal menu selection or input data without terminating the program.

    I'm not asking for exact code, and thus why I didn't post any, but just what I need to look up. If that makes any sense

    Any help?
    You seem to be describing an Exception -- is that what you mean?

    -Gary-

  4. #4
    Masochist's Avatar
    Masochist is offline Member
    Join Date
    May 2010
    Posts
    12
    Rep Power
    0

    Default

    Are you in need of an else statement? Or a defualt, if you're using switch?
    - Masochist.

  5. #5
    absoltrainer2 is offline Member
    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Default

    I think it was exception I was thinking of, but i was able to use a combination of if statments combined with a do while loop to get the job done.

    Thansk for the help guys.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •