8768 sujets
Développement web côté serveur, CMS
C'est tes petites roulettes à toi qu'il faut enlever.
https://prismjs.com/plugins/line-numbers/
https://prismjs.com/plugins/line-numbers/
<pre class="language-java">
<code class="language-java">
/*
* AffichageCirculaire.java
*
* Copyright 2019 Tarek Boutefara <t_boutefara@esi.dz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
import java.util.Scanner;
/**
* Cette classe permet d'afficher une valeur à partir d'un tableau
* tout en affichant quelques valeurs à droit et à gauche.
* Cette classe démontre un cas réel de l'utilisation d'un parcour
* circulaire d'un tableau.
*/
public class AffichageCirculaire {
// Les valeurs
public static int[] ROULETTE = new int[] { 0, 32, 15, 19, 4, 21, 2,
25, 17, 34, 6, 27, 13,
36, 11, 30, 8, 23, 10,
5, 24, 16, 33, 1, 20,
14, 31, 9, 22, 18, 29,
7, 28, 12, 35, 3, 26 };
// Le nombre des nombres à droite et à gauche à afficher
public static int COMBIEN_AFFICHER = 9;
public static void main (String args[]) {
Scanner s = new Scanner(System.in);
int position = s.nextInt();
if(position < 0 || position > 36){
System.out.println("Position incorrecte");
}else{
int indice = (position - COMBIEN_AFFICHER + 37) % 37;
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
System.out.format("%02d ", ROULETTE );
indice = (indice + 1) % 37;
}
System.out.println("");
// Un peu de décoration
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
if(i == COMBIEN_AFFICHER)
System.out.print("^");
else
System.out.print(" ");
}
}
}
}
</code>
</pre>
<code class="language-java">
/*
* AffichageCirculaire.java
*
* Copyright 2019 Tarek Boutefara <t_boutefara@esi.dz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
import java.util.Scanner;
/**
* Cette classe permet d'afficher une valeur à partir d'un tableau
* tout en affichant quelques valeurs à droit et à gauche.
* Cette classe démontre un cas réel de l'utilisation d'un parcour
* circulaire d'un tableau.
*/
public class AffichageCirculaire {
// Les valeurs
public static int[] ROULETTE = new int[] { 0, 32, 15, 19, 4, 21, 2,
25, 17, 34, 6, 27, 13,
36, 11, 30, 8, 23, 10,
5, 24, 16, 33, 1, 20,
14, 31, 9, 22, 18, 29,
7, 28, 12, 35, 3, 26 };
// Le nombre des nombres à droite et à gauche à afficher
public static int COMBIEN_AFFICHER = 9;
public static void main (String args[]) {
Scanner s = new Scanner(System.in);
int position = s.nextInt();
if(position < 0 || position > 36){
System.out.println("Position incorrecte");
}else{
int indice = (position - COMBIEN_AFFICHER + 37) % 37;
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
System.out.format("%02d ", ROULETTE );
indice = (indice + 1) % 37;
}
System.out.println("");
// Un peu de décoration
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
if(i == COMBIEN_AFFICHER)
System.out.print("^");
else
System.out.print(" ");
}
}
}
}
</code>
</pre>
<pre class="language-java"><code class="language-java">
/*
* AffichageCirculaire.java
*
* Copyright 2019 Tarek Boutefara <t_boutefara@esi.dz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
import java.util.Scanner;
/**
* Cette classe permet d'afficher une valeur à partir d'un tableau
* tout en affichant quelques valeurs à droit et à gauche.
* Cette classe démontre un cas réel de l'utilisation d'un parcour
* circulaire d'un tableau.
*/
public class AffichageCirculaire {
// Les valeurs
public static int[] ROULETTE = new int[] { 0, 32, 15, 19, 4, 21, 2,
25, 17, 34, 6, 27, 13,
36, 11, 30, 8, 23, 10,
5, 24, 16, 33, 1, 20,
14, 31, 9, 22, 18, 29,
7, 28, 12, 35, 3, 26 };
// Le nombre des nombres à droite et à gauche à afficher
public static int COMBIEN_AFFICHER = 9;
public static void main (String args[]) {
Scanner s = new Scanner(System.in);
int position = s.nextInt();
if(position < 0 || position > 36){
System.out.println("Position incorrecte");
}else{
int indice = (position - COMBIEN_AFFICHER + 37) % 37;
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
System.out.format("%02d ", ROULETTE );
indice = (indice + 1) % 37;
}
System.out.println("");
// Un peu de décoration
for(int i = 0; i < COMBIEN_AFFICHER * 2 + 1; i++){
if(i == COMBIEN_AFFICHER)
System.out.print("^");
else
System.out.print(" ");
}
}
}
}
</code>
</pre>