0
import java.util.Scanner;
public class namefinder {
public static void main(String[] args) {
System.out.println(" NAME PREDICTER ");
System.out.println(" Row 1 A B C D E F");
System.out.println(" Row 2 G H I J K L");
System.out.println(" Row 3 M N O P Q R");
System.out.println(" Row 4 S T U V W X");
System.out.println(" Row 5 Y Z");
System.out.println("enter the length of your first name in number!!! EX: vino , so length is 4");
Scanner scanner = new Scanner(System.in);
int y = scanner.nextInt();
int s[] = new int [20];
for(int i=1;i<=y;i++)
{
System.out.println("Enter whether the "+i+"letter of your name is in which row");
Scanner scanner1 = new Scanner(System.in);
s[i] = scanner1.nextInt();
}
for(int i=0;i<=y;i++){
switch (s[i]){
case 1:
int j;
for(j=0;j<6;j++){
char a[] = {'A','B','C','D','E','F'};
System.out.println(""+'\t'+a[j]);
}
break;
case 2:
for(j=0;j<6;j++){
char a[] = {'G','H','I','J','K','L'};
System.out.println(""+'\t'+a[j]);
}
break;
case 3:
for(j=0;j<6;j++){
char a[] = {'M','N','O','P','Q','R'};
System.out.println(""+'\t'+a[j]);
}
break;
case 4:
for(j=0;j<6;j++){
char a[] = {'S','T','U','V','W','X'};
System.out.println(""+'\t'+a[j]);
}
break;
case 5:
for(j=0;j<6;j++){
char a[] = {'Y','Z'};
System.out.println(""+'\t'+a[j]);
}
break;
}
System.out.println("");
}
}
}
выход:Как напечатать несколько значений массива паралельно
NAME PREDICTER
Row 1 A B C D E F
Row 2 G H I J K L
Row 3 M N O P Q R
Row 4 S T U V W X
Row 5 Y Z
enter the length of your first name in number!!! EX: vino , so length is 4
3
Enter whether the 1letter of your name is in which row
4
Enter whether the 2letter of your name is in which row
2
Enter whether the 3letter of your name is in which row
3
S
T
U
V
W
X
G
H
I
J
K
L
M
N
O
P
Q
R
, но мне нужно напечатать, как
S G M
T H N
U I O
V J P
W K Q
X L R
Значения массива печатаются параллельно, как и ожидалось, теперь мне нужно хранить значения каждой строки в отдельном массиве. Можете ли вы помочь мне в этом. Заранее спасибо, – user2322440