boolean valid;
String binstr;
int i = 0;
char T;
input binstr
find length of binstr
valid = true;
while (valid)
{
while (valid && not beyond the string)
{
T = binstr.CharAt( i );
if (! (T == '0' || T == '1'))
valid = false;
i++;
}
if (!valid)
input binstr (input is not a binary string and please enter again)
}
The problem is when i enter 1 the program just hangs and when i enter 2 it will say it's not a valid binary number and ask for again and if i enter 2 again it will just exit afterwards without checking values again. I am so lost what to do with this now, can anybody help me.
This post has been edited by born2c0de: 07 November 2008 - 12:31 AM

New Topic/Question
Reply




MultiQuote




|