简单问题,高分回复!!!(欢迎各位大哥踊跃参加)
来源: 互联网 发布时间:2015-07-02
本文导语: 以下是原代码 //===java.key=== import javax.swing.JOptionPane; import java.lang.String; public class key { public static void main(String args[]) { int i=3; int m,n; do { String x=JOptionPane.showInputDialog("输入整数密码:"); int m=Integer.parse...
以下是原代码
//===java.key===
import javax.swing.JOptionPane;
import java.lang.String;
public class key
{
public static void main(String args[])
{
int i=3;
int m,n;
do
{
String x=JOptionPane.showInputDialog("输入整数密码:");
int m=Integer.parseInt(n);
i=i-1;
n=i;
JOptionPane.showMessageDialog(
null,
"输入的密码不正确,请重新输入:"+"/n您还有"+n+"次机会!",
JOptionPane.WARNING_MESSAGE);
}
while (m!=123 || n!=0);
if (m==123)
JOptionPane.showMessageDialog(
null,
"您输入的密码是:123"),
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
if (n==0)
JOptionPane.showMessageDialog(
null,
"您输入的密码都不正确,请确认后再执行程序!");
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
//===java.key===
import javax.swing.JOptionPane;
import java.lang.String;
public class key
{
public static void main(String args[])
{
int i=3;
int m,n;
do
{
String x=JOptionPane.showInputDialog("输入整数密码:");
int m=Integer.parseInt(n);
i=i-1;
n=i;
JOptionPane.showMessageDialog(
null,
"输入的密码不正确,请重新输入:"+"/n您还有"+n+"次机会!",
JOptionPane.WARNING_MESSAGE);
}
while (m!=123 || n!=0);
if (m==123)
JOptionPane.showMessageDialog(
null,
"您输入的密码是:123"),
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
if (n==0)
JOptionPane.showMessageDialog(
null,
"您输入的密码都不正确,请确认后再执行程序!");
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
|
import javax.swing.JOptionPane;
import java.lang.String;
public class key {
public static void main(String args[]) {
int i = 3;
int m,n;
do {
String x = JOptionPane.showInputDialog("please input the key:");
m = Integer.parseInt(x);
i = i - 1;
n = i;
if (m != 123 && n != 0) {
JOptionPane.showMessageDialog( null,
"the key is wrong, please reinput:"+"n you have " + n + " times!",
"input",
JOptionPane.WARNING_MESSAGE);
}
} while (m != 123 && n != 0);
if (m == 123) {
JOptionPane.showMessageDialog( null,
"you input is right!",
"ok",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
if (n == 0) {
JOptionPane.showMessageDialog( null,
"sorry, you input is wrong!",
"error",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
}
import java.lang.String;
public class key {
public static void main(String args[]) {
int i = 3;
int m,n;
do {
String x = JOptionPane.showInputDialog("please input the key:");
m = Integer.parseInt(x);
i = i - 1;
n = i;
if (m != 123 && n != 0) {
JOptionPane.showMessageDialog( null,
"the key is wrong, please reinput:"+"n you have " + n + " times!",
"input",
JOptionPane.WARNING_MESSAGE);
}
} while (m != 123 && n != 0);
if (m == 123) {
JOptionPane.showMessageDialog( null,
"you input is right!",
"ok",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
if (n == 0) {
JOptionPane.showMessageDialog( null,
"sorry, you input is wrong!",
"error",
JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
}