tp7
This commit is contained in:
@@ -196,8 +196,8 @@ void mettre_a_jour_grille(int tab_image[8][8], int nb_de_lignes, int nb_de_colon
|
|||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int nb_de_lignes = 3;
|
int nb_de_lignes = 8;
|
||||||
int nb_de_colonnes = 3;
|
int nb_de_colonnes = 8;
|
||||||
int decalage = 10;
|
int decalage = 10;
|
||||||
int largeur_image = 1710;
|
int largeur_image = 1710;
|
||||||
int hauteur_image = 900;
|
int hauteur_image = 900;
|
||||||
@@ -224,6 +224,8 @@ int main(void) {
|
|||||||
while (rand_1_1 + rand_1_2 == 0) {
|
while (rand_1_1 + rand_1_2 == 0) {
|
||||||
rand_1_1 = (rand() % nb_de_lignes);
|
rand_1_1 = (rand() % nb_de_lignes);
|
||||||
rand_1_2 = (rand() % nb_de_colonnes);
|
rand_1_2 = (rand() % nb_de_colonnes);
|
||||||
|
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rand_2_1 = (rand() % nb_de_lignes);
|
int rand_2_1 = (rand() % nb_de_lignes);
|
||||||
@@ -232,7 +234,9 @@ int main(void) {
|
|||||||
while (rand_2_1 + rand_2_2 == 0) {
|
while (rand_2_1 + rand_2_2 == 0) {
|
||||||
rand_2_1 = (rand() % nb_de_lignes);
|
rand_2_1 = (rand() % nb_de_lignes);
|
||||||
rand_2_2 = (rand() % nb_de_colonnes);
|
rand_2_2 = (rand() % nb_de_colonnes);
|
||||||
}
|
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
int temp = tab_image[rand_1_1][rand_1_2];
|
int temp = tab_image[rand_1_1][rand_1_2];
|
||||||
tab_image[rand_1_1][rand_1_2] = tab_image[rand_2_1][rand_2_2];
|
tab_image[rand_1_1][rand_1_2] = tab_image[rand_2_1][rand_2_2];
|
||||||
|
|||||||
0
DEV3.2/TP06/03_Hachage/Dictionnaire.java
Normal file
0
DEV3.2/TP06/03_Hachage/Dictionnaire.java
Normal file
0
DEV3.2/TP07/01_Repertoires/RACINE/fichier1.txt
Normal file
0
DEV3.2/TP07/01_Repertoires/RACINE/fichier1.txt
Normal file
BIN
DEV3.2/TP07/01_Repertoires/Repertoires.class
Normal file
BIN
DEV3.2/TP07/01_Repertoires/Repertoires.class
Normal file
Binary file not shown.
43
DEV3.2/TP07/01_Repertoires/Repertoires.java
Normal file
43
DEV3.2/TP07/01_Repertoires/Repertoires.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Repertoires {
|
||||||
|
|
||||||
|
private File valeur;
|
||||||
|
private ArrayList<Repertoires> fils;
|
||||||
|
|
||||||
|
public Repertoires(File racine) {
|
||||||
|
if (!racine.isDirectory()) {
|
||||||
|
this.valeur = racine;
|
||||||
|
this.fils = null;
|
||||||
|
} else {
|
||||||
|
this.fils = new ArrayList<>();
|
||||||
|
this.valeur = racine;
|
||||||
|
for (File fichier : racine.listFiles()) {
|
||||||
|
this.fils.add(new Repertoires(fichier));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(int nbRecursions) {
|
||||||
|
String aRenvoyer = "";
|
||||||
|
for (int i = 0; i != nbRecursions; i++) {
|
||||||
|
aRenvoyer += " ";
|
||||||
|
}
|
||||||
|
aRenvoyer += this.valeur.getName() + "\n";
|
||||||
|
if (this.fils != null) {
|
||||||
|
for (Repertoires fichier : this.fils) {
|
||||||
|
aRenvoyer += fichier.toString(nbRecursions + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRenvoyer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Repertoires racine = new Repertoires(new File(args[0]));
|
||||||
|
System.out.println(racine.toString(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
38
DEV3.2/TP07/02_Prefixe/Main.java
Normal file
38
DEV3.2/TP07/02_Prefixe/Main.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ArrayDeque<String> pile = new ArrayDeque<>(args.length);
|
||||||
|
|
||||||
|
for (int i = 0; i != args.length; i++) {
|
||||||
|
try {
|
||||||
|
Integer.parseInt(args[i]);
|
||||||
|
pile.addFirst(args[i]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
int n2 = Integer.parseInt(pile.removeFirst());
|
||||||
|
int n1 = Integer.parseInt(pile.removeFirst());
|
||||||
|
System.out.println(n2);
|
||||||
|
System.out.println(n1);
|
||||||
|
|
||||||
|
switch (args[i]) {
|
||||||
|
case "+":
|
||||||
|
pile.addFirst(n1 + n2 + "");
|
||||||
|
break;
|
||||||
|
case "-":
|
||||||
|
pile.addFirst(n1 - n2 + "");
|
||||||
|
break;
|
||||||
|
case "x":
|
||||||
|
pile.addFirst(n1 * n2 + "");
|
||||||
|
break;
|
||||||
|
case "/":
|
||||||
|
pile.addFirst(n1 / n2 + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("= " + pile.removeFirst());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
38
DEV3.2/TP07/02_Prefixe/Prefixe.java
Normal file
38
DEV3.2/TP07/02_Prefixe/Prefixe.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ArrayDeque<String> pile = new ArrayDeque<>(args.length);
|
||||||
|
|
||||||
|
for (int i = 0; i != args.length; i++) {
|
||||||
|
try {
|
||||||
|
Integer.parseInt(args[i]);
|
||||||
|
pile.addFirst(args[i]);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
int n2 = Integer.parseInt(pile.removeFirst());
|
||||||
|
int n1 = Integer.parseInt(pile.removeFirst());
|
||||||
|
System.out.println(n2);
|
||||||
|
System.out.println(n1);
|
||||||
|
|
||||||
|
switch (args[i]) {
|
||||||
|
case "+":
|
||||||
|
pile.addFirst(n1 + n2 + "");
|
||||||
|
break;
|
||||||
|
case "-":
|
||||||
|
pile.addFirst(n1 - n2 + "");
|
||||||
|
break;
|
||||||
|
case "x":
|
||||||
|
pile.addFirst(n1 * n2 + "");
|
||||||
|
break;
|
||||||
|
case "/":
|
||||||
|
pile.addFirst(n1 / n2 + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("= " + pile.removeFirst());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
SAE11_2025/jeu
BIN
SAE11_2025/jeu
Binary file not shown.
@@ -21,7 +21,7 @@ int verifie_si_taquin_complet(int grille[8][8], int nb_de_lignes, int nb_de_colo
|
|||||||
for (i = 0; i < nb_de_lignes; i++) {
|
for (i = 0; i < nb_de_lignes; i++) {
|
||||||
for (j = 0; j < nb_de_colonnes; j++) {
|
for (j = 0; j < nb_de_colonnes; j++) {
|
||||||
if (grille[i][j] != compteur) {
|
if (grille[i][j] != compteur) {
|
||||||
return 0; /* Pas complelt */
|
return 0; /* Pas complet */
|
||||||
}
|
}
|
||||||
compteur++;
|
compteur++;
|
||||||
}
|
}
|
||||||
@@ -196,8 +196,8 @@ void mettre_a_jour_grille(int tab_image[8][8], int nb_de_lignes, int nb_de_colon
|
|||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int nb_de_lignes = 4;
|
int nb_de_lignes = 5;
|
||||||
int nb_de_colonnes = 4;
|
int nb_de_colonnes = 5;
|
||||||
int decalage = 10;
|
int decalage = 10;
|
||||||
int largeur_image = 1710;
|
int largeur_image = 1710;
|
||||||
int hauteur_image = 900;
|
int hauteur_image = 900;
|
||||||
|
|||||||
Reference in New Issue
Block a user