1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public static void main(String[] args) {
String[][] tab = new String[100][10]; // Tableau des questions et
// des réponses
int qIndex = 0; // Variable représentant le n° d'indice de la question
int rIndex = 0; // Variable représentant le n° d'indice de la réponse
String rep;
String quest;
do {
System.out.println("Ecrire une question :");
tab[qIndex][rIndex] = quest = Terminal.lireString();
if (quest.length() != 0) {
do {
System.out.println("Ecrire une réponse :");
rIndex = rIndex + 1;
tab[qIndex][rIndex] = rep = Terminal.lireString();
} while (rep.length() != 0);
} else {
qIndex = qIndex + 1;
}
} while (quest.length() != 0);
for (int i = 0; i < tab.length; i++) {
for (int j = 0; j < tab[i].length; j++) {
System.out.println(tab[i][j]);
}
}
}
} |