Results 1 to 5 of 5
Thread: Need some help!!!
- 06-02-2011, 05:55 AM #1
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
- 06-02-2011, 05:59 AM #2
What do you mean by binary number? eg: 10111011 or something else.
- 06-02-2011, 08:07 AM #3
And if Junky's guess is correct, then you should be reading that as a String and parsing the input.
Recommended reading: How to ask questions the smart way
db
- 06-02-2011, 02:35 PM #4
Member
- Join Date
- Jun 2011
- Posts
- 6
- Rep Power
- 0
junky is correct.
- 06-03-2011, 01:07 AM #5
In that case what Daryl posted is correct. You need to read teh input as a String. then you have 2 options to validate the input.
1. Iterate over the String and check each character is a 1 or 0.
2. Parse the String into an int inside a catch statement. If an exception is thrown then the input is not binary.


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks