- Feb 3, 2005
- 7,326
- 2
- 76
This is indirectly related to a homework assignment. I'm creating a program where the user inputs a binary number, and it converts it to decimal form.
I got that all down, but I'm trying to make the program "nicer". I have the basics down...I'll probably get an A on this portion of it, but I have an extra day to work on it and figured I'd do a bit extra for my own learning.
Is there any way to check to see if the binary string the use inputs contains anything but 0's or 1's? I didn't know if there was a quick method or API code (I think it's called that) that could do this for me...if not, could anyone offer some quick help on creating a method that would check this for me (I'm not asking you to make the code for me, but if you do, that's OK with me
)?
I got that all down, but I'm trying to make the program "nicer". I have the basics down...I'll probably get an A on this portion of it, but I have an extra day to work on it and figured I'd do a bit extra for my own learning.
Is there any way to check to see if the binary string the use inputs contains anything but 0's or 1's? I didn't know if there was a quick method or API code (I think it's called that) that could do this for me...if not, could anyone offer some quick help on creating a method that would check this for me (I'm not asking you to make the code for me, but if you do, that's OK with me