//import java.util.Scanner;
import java.util.*;
//import com.sun.corba.se.spi.orbutil.fsm.Input;
public class Game {
public static void main(String[]args){
String a[]={"快乐","高兴","悲伤"};
Scanner sc2=new Scanner(System.in);
for(int i=0;i<=a.length;i++){
int s=sc2.nextInt();//接收输入
if (s==1){
System.out.println(a[0]);
}
else if (s==2){
System.out.println(a[1]);
}
else if (s==3){
System.out.println(a[2]);
}
else {
System.out.println("超标了");
}
}
System.out.println("*******************");
Scanner sc=new Scanner(System.in);
String m="-1";
while(!"t".equalsIgnoreCase(m)){//循环输入
System.out.println("请输入学生成绩:");
int xx=sc.nextInt();//接受输入
if (xx>90){
System.out.println("优秀");
//sc.next();
}
else if (xx>70){
System.out.println("良好");
//sc.next();
}
else if (xx>60){
System.out.println("及格");
//sc.next();
}
else if (xx<60){
System.out.println("不及格");
//sc.next();
}
else {
System.out.println("不要乱输入啦!");
//sc.next();
}
}
/*
Scanner s = new Scanner(System.in);
String m="-1";
while(!"t".equalsIgnoreCase(m)){
System.out.println("请输入学生成绩:");
m = s.next();
if("t".equalsIgnoreCase(m)){
System.out.println("感谢使用");
break;
}else{
int n = Integer.parseInt(m);
String str = (n>=90)?"A":(n>=60)?"B":"C";
System.out.println(str);
}
}*/
}
}
Scanner控制台输入
最新推荐文章于 2022-11-23 18:17:50 发布