Results 1 to 2 of 2

Thread: loopy

  1. #1
    DrKush's Avatar
    DrKush is offline Member
    Join Date
    Feb 2009
    Location
    Charloot NC
    Posts
    14
    Rep Power
    0

    Default loopy

    how do I check the format of user input during a loop?

    "Write a program that prompts a user to enter a positive whole number less than 2000.Your program should contain an input validation loop that checks the range and the format of the user's input.If the input is valid, your program should display the hexadecimal representation of the number. If the input is out of range, your program should display the message: "Invalid range. Try again." If the input is the wrong format, your program should display the message: "Invalid number. Try again." The program should loop until the user enters a valid number."
    I've got an idea--an idea so smart that my head would explode if I even began to know what I'm talking about.

  2. #2
    bigbigbug is offline Member
    Join Date
    Mar 2009
    Posts
    6
    Rep Power
    0

    Default

    you can just do like this..
    while(true){
    input;
    if (your requirement here)
    break;
    else
    output("try again");
    }

Similar Threads

  1. Loop driving me loopy!!!!!
    By soc86 in forum New To Java
    Replies: 8
    Last Post: 01-16-2009, 02:00 AM

Posting Permissions

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