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
|
import java.util.Scanner;
public class Tableau1 {
public static void main(String[] args) {
char reponse = 'O', c = ' ';
char carac[] = {'a','b','c','d','e','f','g','h'};
Scanner sc = new Scanner(System.in);
while (reponse == 'O') {
System.out.println("Inscrivez une lettre de l'alphabet");
c = sc.nextLine().charAt(0);
for(int i = 0; i < carac.length; i++)
if (c < carac.length )
System.out.println("La lettre fait partie de la liste");
else
System.out.println("La lettre ne fait pas partie de la liste");
while (reponse != 'O' && reponse != 'N')
{
System.out.println("Voulez-vous réessayer ? (O/N)");
reponse = sc.nextLine().charAt(0);
}}
System.out.println("Au revoir !");
}
} |
Partager