//账户密码登录,成功或者失败,成功进入后循环打印图形,不需要打印再退出
package homework1116;
//账户密码登录,成功或者失败,成功进入后循环打印图形,不需要打印再退出
import java.util.Scanner;
public class Homework1116_4 {
public static void main(String[] args) {
Scanner mm=new Scanner(System.in);
System.out.println("sure:");
int sure=mm.nextInt();
System.out.println("pwd:");
// int sure=mm.nextInt();
int pwd=mm.nextInt();
if(sure==12 && pwd==89){
System.out.println("登录成功");
while(true){
System.out.println("A打印正方形");
System.out.println("B打印正直角三角形");
System.out.println("C打印倒直角三角形");
System.out.println("D打印空心正方形");
System.out.println("E退出");
Scanner gg=new Scanner(System.in);
System.out.println("请选择要打印的图形:");
String str=gg.next();
char chr=str.toCharArray() [0];
switch (chr){
// switch (str){
case ‘A‘:
for(int n=1;n<=4;n++){
for(int m=1;m<=4;m++){
System.out.print("\t"+"*");
}
System.out.println("\n");
}
break;
case ‘B‘:
for(int m=1;m<=3;m++){
for(int n=1;n<=m;n++){
System.out.print("*");
}
System.out.println("");
}
break;
case ‘C‘:
for(int m=1;m<=3;m++){
for(int n=3;n>=m;n--){
System.out.print("*");
}
System.out.println();
}
break;
case ‘D‘:
for(int m=1;m<=4;m++){
for(int n=1;n<=4;n++){
if(((m==2|m==3) &(n==2)) | ((m==2|m==3)&(n==3))){
System.out.print("\t"+" ");
}
else{
System.out.print("\t"+"*");
}
}
System.out.println("\n");
}
break;
case ‘E‘:
System.exit(-1);
break;
default:
break;
}
System.out.println();}
}else{
System.out.println("登录失败");
}
}
}