字母表模式,包括星号-Java
我是Java新手,一直坚持这个任务,虽然我已经完成了它,但我想在没有字母表模式,包括星号-Java,java,Java,我是Java新手,一直坚持这个任务,虽然我已经完成了它,但我想在没有if-else语句的情况下完成它 for(int i=0; i<numRows; i++) { for(int j=0; j<numRows-i; j++) { System.out.print(" "); } for(int k = 0; k <= i*2; k++) { if(k%2 == 1) Syste
if-else
语句的情况下完成它
for(int i=0; i<numRows; i++)
{
for(int j=0; j<numRows-i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= i*2; k++)
{
if(k%2 == 1)
System.out.print("A");
else
System.out.print("*");
}
System.out.println();
}
publicstaticvoidmain(字符串[]args){
int numRows=5;
字符串s=“*A*”;
字符串空格=”;
对于(int i=0;i
由于每行以星号开头,然后重复A*
n次(其中n是行号-1,即第一行0,第二行1等),因此您可以在循环中执行此操作,即打印第一个星号,然后根据需要重复A*
例如:
for( int i = 0; i < numRows; i++ )
{
//print whitespace for correct indentation
for( int j = 0; j < numRows - i; j++ )
{
System.out.print( " " );
}
//print the first asterisk
System.out.print( "*" );
//print as many A* as needed, i.e. row-1 times
for( int k = 0; k < i; k++ )
{
System.out.print( "A*" );
}
System.out.println();
}
for(int i=0;i
将if-else更改为以下代码中提到的行
int numRows=5;
for(int i=0; i<numRows; i++)
{
for(int j=0; j<numRows-i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= i*2; k++)
{
//calculates according to mod value of k
char ch=(char) (((k%2)*'A')+((1-k%2)*'*'));
System.out.print(ch);
}
System.out.println();
}
int numRows=5;
对于(int i=0;i代码第1部分
String nom,silaba;
int nomlong,longi,z=0;
char ass;
nom=txt1.getText();
nomlong=nom.length();
txtapex.setText("");
do{
silaba=nom.substring(0+z, 1+z);
char c=silaba.charAt(0);
int ascii = (int) c;
switch(ascii){
case 65:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 97:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 66:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j-i==-2){
txtapex.append("8 ");
}else if(j==1){
txtapex.append(" ");
}else if(j-i==-1){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j+i==6){
txtapex.append("8 ");
}else if(j+i==7){
txtapex.append(" ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 98:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j-i==-2){
txtapex.append("8 ");
}else if(j==1){
txtapex.append(" ");
}else if(j-i==-1){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j+i==6){
txtapex.append("8 ");
}else if(j+i==7){
txtapex.append(" ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 67:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 99:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 68:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==-3){
txtapex.append(" ");
}else if(i+j==7){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 100:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==-3){
txtapex.append(" ");
}else if(i+j==7){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 69:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 101:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 70:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 102:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 71:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j+i==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(i==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else if(i==3){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 103:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j+i==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(i==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else if(i==3){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 72:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 104:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 73:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==4){
txtapex.append(" ");
}else if(j+i==0){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 105:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==4){
txtapex.append(" ");
}else if(j+i==0){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 74:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j==0){
txtapex.append("8 ");
}else if(j-i==2){
txtapex.append(" ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 106:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j==0){
txtapex.append("8 ");
}else if(j-i==2){
txtapex.append(" ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 75:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==1){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 107:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==1){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 76:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append(" ");
}else if(i==1){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 108:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append(" ");
}else if(i==1){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
字符串名称,silaba;
int nomlong,longi,z=0;
炭疽;
nom=txt1.getText();
nomlong=nom.length();
txtpex.setText(“”);
做{
silaba=标称子串(0+z,1+z);
char c=silaba.charAt(0);
int ascii=(int)c;
开关(ascii){
案例65:
对于(int j=0;jI)来说,我认为这个问题需要在stack exchange上的另一个社区中提出。“我想在不使用if-else语句的情况下解决。”-为什么?你可以使用地图,但这不会使它更容易阅读或执行得更快。@Thomas,因为这正是我的老师想要的--我似乎找不到出路!你的老师可以使用三元数吗?@DylanMeeus他要求只对循环使用
。有可能吗?这似乎太复杂,因此容易出错。这里到底发生了什么?char ch=(char)((k%2)*'A')+((1-k%2)*'*');
?如果k是偶数,那么“(k%2)*'A'”将产生0,否则((1-k%2)*'')将产生0,因此剩余部分将被铸造为char,因此ch将是“A”或“正是我刚才所做的!干杯兄弟!您的代码不可读用户希望更简单易读
int numRows=5;
for(int i=0; i<numRows; i++)
{
for(int j=0; j<numRows-i; j++)
{
System.out.print(" ");
}
for(int k = 0; k <= i*2; k++)
{
//calculates according to mod value of k
char ch=(char) (((k%2)*'A')+((1-k%2)*'*'));
System.out.print(ch);
}
System.out.println();
}
String nom,silaba;
int nomlong,longi,z=0;
char ass;
nom=txt1.getText();
nomlong=nom.length();
txtapex.setText("");
do{
silaba=nom.substring(0+z, 1+z);
char c=silaba.charAt(0);
int ascii = (int) c;
switch(ascii){
case 65:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 97:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 66:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j-i==-2){
txtapex.append("8 ");
}else if(j==1){
txtapex.append(" ");
}else if(j-i==-1){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j+i==6){
txtapex.append("8 ");
}else if(j+i==7){
txtapex.append(" ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 98:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==-3){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j-i==-2){
txtapex.append("8 ");
}else if(j==1){
txtapex.append(" ");
}else if(j-i==-1){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j+i==6){
txtapex.append("8 ");
}else if(j+i==7){
txtapex.append(" ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 67:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 99:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i+j==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 68:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==-3){
txtapex.append(" ");
}else if(i+j==7){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 100:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==-3){
txtapex.append(" ");
}else if(i+j==7){
txtapex.append(" ");
}else if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 69:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 101:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 70:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 102:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j*i==0){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 71:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j+i==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(i==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else if(i==3){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 103:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j+i==0){
txtapex.append(" ");
}else if(j-i==4){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(i==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append(" ");
}else if(j==2){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else if(i==3){
txtapex.append("8 ");
}else if(j*i==3){
txtapex.append(" ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 72:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 104:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(i==3){
txtapex.append("8 ");
}else if(j==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 73:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==4){
txtapex.append(" ");
}else if(j+i==0){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 105:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j-i==4){
txtapex.append(" ");
}else if(j+i==0){
txtapex.append(" ");
}else if(j==0){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 74:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j==0){
txtapex.append("8 ");
}else if(j-i==2){
txtapex.append(" ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 106:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(j==0){
txtapex.append("8 ");
}else if(j-i==2){
txtapex.append(" ");
}else if(j-i==3){
txtapex.append("8 ");
}else if(i==2){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 75:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==1){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 107:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append("8 ");
}else if(j-i==1){
txtapex.append("8 ");
}else if(j+i==3){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 76:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append(" ");
}else if(i==1){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;
case 108:
for(int j=0;j<5;j++){
for (int i = 0; i < 4; i++) {
if(i==0){
txtapex.append(" ");
}else if(i==1){
txtapex.append("8 ");
}else if(j==4){
txtapex.append("8 ");
}else{
txtapex.append(" ");
}
}
txtapex.append("\n");
}
txtapex.append("\n");
break;