initial commit

This commit is contained in:
Guillaume-Sanchez
2026-05-26 13:56:03 +02:00
parent 4c720637a1
commit ff4bb12d22
539 changed files with 12415 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
# 503 06/01/2025
## Tableau
>Unidimentionnel -> C'est un tableau de type vecteur
>MultiDimentionnel -> C'est un tableau de type matrice
### Tableau Unidimentionnel
Un tableau est une variable un peu particlière, nous pouvons lui affecter plusieurs valeurs ordonnées séquentiellement.
Tab1 = {5,1,8,3,4,7,6,7,8,0}
Nous appelons ces valeurs au moyen d'un indice.
- Tab1 = {5,1,8,3,4,7,6,7,8,0}
- indice = {0,1,2,3,4,5,6,7,8,9}
Un indice permet de se positionnener dans un tableau, d'identifier une valeur, exemple ci dessus, [0] = 5
Déclaration d'un tableau en java :
<"Type du Tableau"> <"nom du tableau"> [] = {"contenu du tableau"}
Dans la pratique :
```
int tableauEntier[] = {0,1,2,3,4,5,6,7,8,9};
double tableauDouble
```
Déclaration d'un tableau à une dimention :
```
int tableauEntier[] = new int[6];
ou
int[] tableauEntier2[] = new int[6];
```
### Tableau multidimentionnel :
Un tableau multidimentionnel n'est rien d'autre qu'un tableau contenant au minimum deux tableaux.
Exemple soit un tableau multidimentionnel (2 lignes) appelé premierNombre
- La première contiendra les nombres paires
- La seconde contiendra les nombres impraires
PremierNombre = {{0,2,4,6,8},{1,3,5,7,9}};
>Conceille pratique utiliser la methode clone() pour éviter d'utiliser votre tableau originel.
## Fonction et Procédure
- Méthode : peut être une fonction ou une prcoédure
- Fonction : retourne une valeur
- Procédure : ne retourne pas de valeur
Une fonction permet de créer un traitement qui pourra être utiliser à chaque fois qu'on en a besoin.
`public static double`
Détails de cela :
- Tous d'abort public, C'est ce qui définit la portée de la méthodes (programmation objets)
- Ensuite il y a static
- Juste après nous avons double, Il s'agit du type de retour de la méthode. Pour faire simple, ici, notre méthode va renvoyer un double.
- Vient ensuite le nom de la méthode, C'est avec ce nom que nous l'appellerons
- Puis arrivent les arguments de la méthode. Ce sont en fait les paramètres ont la méthode à besoin.
etc...
+18
View File
@@ -0,0 +1,18 @@
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
Binary file not shown.
+121
View File
@@ -0,0 +1,121 @@
public class App {
public static void main(String[] args) throws Exception {
// Exemple d'un tableau unidimentionnel
System.out.println("================== Cours ===================");
System.out.println("");
int tab[] = {1,2,3,4};
for(int i=0; i < tab.length; i++){
System.out.println("La valeur " + tab[i] + " a pour indice " + i);
}
System.out.println("La valeur du dernier élément du tableau est : " + tab[tab.length -1]);
System.out.println("");
System.out.println("===============================================");
System.out.println("");
// Exemple d'un tableau multidimentionnel
int premierNombres[][] = {{1,2,3,4},{5,6,7,8}};
// for(int i=0;i<2;i++){
// for(int j=0;j<4;j++){
// System.out.print(premierNombres[i][j]);
// }
// System.out.println("");
// }
int i = 0;
while(i < 2){
int j = 0;
while(j < 4){
System.out.print(premierNombres[i][j]);
j++;
}
System.out.println("");
i++;
}
// Exemple 1 :
System.out.println("");
System.out.println("=============== Exercice 1================");
System.out.println("");
int tabExemple1[] = {75,25};
System.out.println(tabExemple1[0] + " + " + tabExemple1[1] + " = " + tabExemple1[0]+tabExemple1[1]);
// Exemple 2 :
System.out.println("");
System.out.println("=============== Exercice 2================");
System.out.println("");
int tabExemple2[] = {5,5};
System.out.println(tabExemple2[0] + " * " + tabExemple2[1] + " = " + tabExemple2[0]*tabExemple2[1]);
// Exemple 3 :
System.out.println("");
System.out.println("=============== Exerice 3================");
System.out.println("");
int tabACopier[] = {1,2,3,4,5,6,7,8,9};
int tabExemple3[] = tabACopier.clone();
for(i=0; i < tabACopier.length; i++){
//tabExemple3[i] = tabACopier[i];
System.out.print(tabExemple3[i]);
}
// System.out.println("");
System.out.println("");
System.out.println("=============== Suite Cours, les Fonctions : ================");
System.out.println("");
// Les Méthode utiles :
System.out.println("Voici une valeur aléatoire : " + Math.random());
System.out.println("Voici le sinus de 120 : " + Math.sin(120));
System.out.println("Voici le cosinus de 120 : " + Math.cos(120));
System.out.println("Voici la tangente de 120 : " + Math.tan(120));
System.out.println("La valeur absolu de -120.25 : " + Math.abs(-125.25));
System.out.println("L'exposant de 2 ': " + Math.pow(2, 2));
System.out.println("");
System.out.println("=============== Créer sa méthode : ================");
System.out.println("");
// Exemple avec la méthode printLnTableau :
int tableau1[] = {1,2,3,4,5,6,7,8,9};
int tableau2[] = {9,8,7,6,5};
int tableau3[] = {4,3,2,1,0};
printLnTableau(tableau1);
printLnTableau(tableau2);
printLnTableau(tableau3);
String tabBis1[] = {"toto","tata","titi","tutu"};
printTableauString(tabBis1);
}
static void printLnTableau(int tab[]){
System.out.print("|");
for(int i=0; i<tab.length; i++){
System.out.print(tab[i] + "|");
}
System.out.println("");
}
static void printTableauString( String[] tabBis){
for(String str : tabBis){
System.out.println(str);
}
}
}
@@ -0,0 +1,18 @@
## Getting Started
Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
## Folder Structure
The workspace contains two folders by default, where:
- `src`: the folder to maintain sources
- `lib`: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the `bin` folder by default.
> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there.
## Dependency Management
The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies).
Binary file not shown.
@@ -0,0 +1,39 @@
public class App {
public static void main(String[] args) throws Exception {
String tableau[] = {"toto", "tata", "titi", "tutu"};
parcourirTableau(tableau);
System.out.println(toString2(tableau));
}
static void parcourirTableau(String tab[]){
System.out.println("Parcours du tableau :");
for(String str : tab){
System.out.println(str);
}
}
static void toString(String tab[]){
System.out.println("Affiche la tableau en chaine de caractère :");
for(String str : tab){
System.out.print(str);
}
System.out.println("");
}
static String toString2(String tab[]){
System.out.println("Méthode toString()");
String retour = "";
for(String str : tab){
retour += str + "\n";
}
return retour;
}
}