76 lines
1.1 KiB
C
76 lines
1.1 KiB
C
#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 g;
|
|
int vdr = -1;
|
|
int acc=-51;
|
|
srand(time(NULL));
|
|
printf("Donnez une valeur");
|
|
scanf("%d", &g);
|
|
for (i = 0; i< 10; i++){
|
|
b = -50+rand()%101;
|
|
tab[i] = b;
|
|
if (tab[i] > acc){
|
|
acc = tab[i];
|
|
}
|
|
if (tab[i] == g){
|
|
vdr == 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("+");
|
|
printf("\n");
|
|
if (vdr == -1){
|
|
printf("%d", -1);
|
|
}
|
|
if (vdr != -1){
|
|
printf("%d", vdr);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|