Это очень простая программа. Компьютер и пользователь выбирают число от 0 до 3. Я хочу, чтобы программа зациклилась, если пользователь не угадывает тот же номер, что и компьютер.
String input; // input is a string variable
int cpucrazy;
int convertstring;
// Первый шаг //
input = JOptionPane.showInputDialog("Guess a number between 0-3");
convertstring = Integer.parseInt(input);
// Случайный раздел //
Random ran = new Random ();
cpucrazy = ran.nextInt(3);
// вычисление!
if (cpucrazy < convertstring) {
JOptionPane.showInputDialog(null, "Your guess is too high. Guess again?"); }
else if (cpucrazy > convertstring) {
JOptionPane.showInputDialog(null, "Your guess is too low. Guess again?"); }
else JOptionPane.showMessageDialog(null, "Correct!!");