Skip to content
Snippets Groups Projects
Verified Commit 2a2be418 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

maj pour cours 4

parent dda6a059
No related branches found
No related tags found
No related merge requests found
......@@ -307,7 +307,7 @@ Trier un tableau par ordre croissant.
```C
ind = 0
tant que (ind < SIZE-1)
Trouver le minimum du tableau, tab_min[ind:SIZE].
Trouver le minimum du tableau, tab_min = min([ind:SIZE]).
Échanger tab_min avec tab[ind]
ind += 1
```
......
......@@ -10,9 +10,9 @@ date: "2023-10-10"
. . .
1. Soit un tableau d'entiers, `tab[0:SIZE-1]` et `i = 0`.
2. Trouver l'indice, `j`, de `tab[i:SIZE-2]` où la valeur est minimale.
2. Trouver l'indice, `j`, de `tab[i:SIZE-1]` où la valeur est minimale.
3. Échanger `tab[i]` et `tab[j]`.
4. `i += 1` et revenir à 2, tant que `j < SIZE-2`.
4. `i += 1` et revenir à 2, tant que `i < SIZE-1`.
# Tri par sélection
......@@ -92,6 +92,8 @@ char name[100] = "Paul is not 100 characters long.";
# Fonctions
\footnotesize
- Il existe une grande quantités de fonction pour la manipulation de chaînes de caractères dans `string.h`.
- Fonctions principales:
......@@ -265,7 +267,7 @@ int main() {
## Exercice:
* Réusiner le code se trouvant sur
[Cyberlearn](https://cyberlearn.hes-so.ch/mod/resource/view.php?id=1627712).
[Cyberlearn](https://cyberlearn.hes-so.ch/pluginfile.php/703384/mod_resource/content/1/comprendre.c).
# Tableau à deux dimensions (1/4)
......@@ -308,7 +310,11 @@ tab[2][1] = 14; // assignation de 14 à la position 2, 1
# Tableau à deux dimensions (3/4)
## Exercice: déclarer et initialiser aléatoirement un tableau `50x100`
\footnotesize
## Exercice:
Déclarer et initialiser aléatoirement un tableau `50x100` avec des valeurs `0` à `255`
. . .
......@@ -513,7 +519,7 @@ $$
while (N >= 0) {
bit = num / 2^N
num = num % 2^N
N += 1
N -= 1
}
```
......@@ -772,7 +778,7 @@ struct fraction { // déclaration du type
int32_t num, denom;
}
struct fraction frac; // déclaration de frac
struct fraction frac; // déclaration de la variable frac
```
# Types composés: `struct`{.C} (3/6)
......@@ -824,7 +830,7 @@ struct fraction frac; // déclaration de frac
void fraction_init(fraction_t *frac,
int32_t re, int32_t im)
{
// frac a déjà été allouée
// hypothèse: frac a déjà été allouée
frac->num = frac;
frac->denom = denom;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment