开发者

Java Program using Loops and Jump Statement

开发者 https://www.devze.com 2023-02-15 03:15 出处:网络
I need to create a program that will ask a password three times. But at the third time, having incorrect password, it will just ask for your name. We are asked to use loops on this and jump statements

I need to create a program that will ask a password three times. But at the third time, having incorrect password, it will just ask for your name. We are asked to use loops on this and jump statements. Ple开发者_开发知识库ase help. ;)


It's general algoritm,

for (int i = 0; i < 3; i++)
{
   if (i == 2 and password != true_password)
      ask_name();
}

But for more you can give your code.

p.s. declare i in the loop, thank you @glowcoder for remark.

0

精彩评论

暂无评论...
验证码 换一张
取 消