bonjour,
je suis débutant et je veux faire une questionnaire question/reponse mais mon programme m'affiche que les dernière valeurs saisie pas tous !
quelqu'un a une solution ou une autre idées
merci a l'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package projetQCM;
 
import java.util.Scanner;
 
public class ExoTest {
 
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int res=0,n=2;
		String []tab1= new String[1];
		String [][]tab2= new String[1][2];
		do{
			for (int i = 0; i < tab1.length; i++) {
			System.out.println("une Question");
			tab1[i]=sc.nextLine();
			}
 
		for (int i = 0; i < tab2.length; i++) {
			System.out.println("une reponse");
			for (int j = 0; j < tab2[i].length; j++) {
				System.out.print((j+1)+" - ");
				tab2[i][j]=sc.nextLine();
			}
		}
		res++;
		}while(res<n);
 
		afficher(tab1);
		afficher2(tab2);
 
	}
 
 
	public static void afficher(String []tab){
		for (int i = 0; i < tab.length; i++) {
			System.out.println(tab[i]+" ");
 
		}
	}
	public static void afficher2(String [][]tab){
		for (int i = 0; i < tab.length; i++) {
			for (int j = 0; j < tab[i].length; j++) {
				System.out.println(tab[i][j]+" ");
			}
 
 
		}
	}
 
}