Commentaires ajoutés

This commit is contained in:
Paul Faure 2021-07-30 10:10:18 +02:00
parent 0408cf8fa0
commit 3584168cce
3 changed files with 1 additions and 79 deletions

@ -1 +1 @@
Subproject commit eef4708fbaefab57b4c4e49d0ca7311e9f0f8b85
Subproject commit d3d3c6da9c0e1d4415428545ad507b4c2ffedace

View file

@ -1,26 +0,0 @@
int chose_number() {
int i = get();
return i;
}
int compare(int nb, int prop) {
int rt;
if (prop > nb) {
rt = -1;
} else if (prop < nb) {
rt = 1;
} else {
rt = 0;
}
return rt;
}
int main() {
int valeur = chose_number();
int prop = valeur + 50;
while (!(prop == valeur)) {
prop = get();
printf(compare(valeur, prop));
}
}

52
max.c
View file

@ -1,52 +0,0 @@
int print_alarm1() {
int j = 0;
while (j<5) {
printf(255);
stop(7);
printf(0);
stop(7);
j = j+1;
}
}
int print_alarm2() {
int j = 0;
while (j<5) {
printf(170);
stop(7);
printf(85);
stop(7);
j = j+1;
}
}
int get_value() {
print_alarm2();
stop(100);
int i = get();
return i;
}
int max(int * tab, int size) {
int i = 0;
int max = 0;
while (i<size) {
if (tab[i] > max) {
max = tab[i];
}
i = i+1;
}
return max;
}
int main() {
int tab[10];
int i = 0;
while (i<10) {
tab[i] = get_value();
i = i+1;
}
print_alarm1();
printf(max(tab, 10));
}