DEV_BUT1/DEV1.1/TP08/remplissage.c

62 lines
890 B
C
Raw Normal View History

2022-10-18 14:50:36 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
int tab[10] = {};
int i;
int b;
int a;
int c;
int d;
int e;
int f;
int acc=-51;
srand(time(NULL));
for (i = 0; i< 10; i++){
b = -50+rand()%101;
tab[i] = b;
if (tab[i] > acc){
acc = tab[i];
}
}
for(f = 0; f <= 9; f++){
if (acc ==tab[f]){
printf(" | ");
}
if (acc != tab[f]){
printf(" ");
}
}
printf("\n");
for(f = 0; f <= 9; f++){
if (acc ==tab[f]){
printf(" v ");
}
if (acc != tab[f]);
printf(" ");
}
printf("\n");
for(a=0; a<=9;a++){
printf("+");
for(c=0; c <5; c++){
printf("-");
}
}
printf("+");
printf("\n");
for(d = 0; d < 10; d++){
printf("|");
printf("%5d", tab[d]);
}
printf("|");
printf("\n");
for(a=0; a<=9;a++){
printf("+");
for(c=0; c <5; c++){
printf("-");
}
}
printf("+");
return EXIT_SUCCESS;
}