import java.util.Scanner;
class qq{
private int a=0;
private int b=0;
private int c=0;
private double d=0;
public void seta(int aa){
a=aa;
}
public void setb(int bb){
b=bb;
}
public void setc(int cc){
c=cc;
}
public void setd(int dd){
d=dd;
}
public void oo(){
Scanner input=new Scanner(System.in);
System.out.println("输入666退出");
int i=1;
while (i!=666){
int e=(int)(0+Math.random()*(9));
System.out.println(e);
int j=input.nextInt();
a++;
if (j==666){
break;
}
if (j==e){
b++;
}
if (j!=e){
c++;
}
d=(double)b/a*100;
System.out.println("总字数"+this.geta()+"正确数"+this.getb()+"错误数"+this.getc()+"正确率"+this.getd()+"%");
}
}
public int geta(){
return a;
}
public int getb(){
return b;
}
public int getc(){
return c;
}
public double getd(){
return d;
}
}
public class zwx{
public static void main(String args[]){
qq a=new qq();
a.oo();
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)