debut TP12
This commit is contained in:
BIN
DEV1.1/TP11/maximum
Executable file
BIN
DEV1.1/TP11/maximum
Executable file
Binary file not shown.
48
DEV1.1/TP11/maximum.c
Normal file
48
DEV1.1/TP11/maximum.c
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe,val_max,indice;
|
||||||
|
int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10};
|
||||||
|
srand(time(NULL));
|
||||||
|
for (tour=0;tour<10;tour++){
|
||||||
|
tab_val[tour]=rand()%51;
|
||||||
|
int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)};
|
||||||
|
signe=rand()%2;
|
||||||
|
tab_val[tour]=tab_temp[signe];
|
||||||
|
}
|
||||||
|
val_max=tab_val[0];
|
||||||
|
indice=0;
|
||||||
|
for (tour=1;tour<10;tour++){
|
||||||
|
if (val_max<tab_val[tour]){
|
||||||
|
val_max=tab_val[tour];
|
||||||
|
indice=tour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf(" ");
|
||||||
|
for (tour=0;tour<indice;tour++)
|
||||||
|
printf(" ");
|
||||||
|
printf(" ");
|
||||||
|
printf("|");
|
||||||
|
printf("\n");
|
||||||
|
printf(" ");
|
||||||
|
for (tour=0;tour<indice;tour++)
|
||||||
|
printf(" ");
|
||||||
|
printf(" ");
|
||||||
|
printf("V");
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
BIN
DEV1.1/TP11/miroir
Executable file
BIN
DEV1.1/TP11/miroir
Executable file
Binary file not shown.
45
DEV1.1/TP11/miroir.c
Normal file
45
DEV1.1/TP11/miroir.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe;
|
||||||
|
int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10};
|
||||||
|
srand(time(NULL));
|
||||||
|
for (tour=0;tour<10;tour++){
|
||||||
|
tab_val[tour]=rand()%51;
|
||||||
|
int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)};
|
||||||
|
signe=rand()%2;
|
||||||
|
tab_val[tour]=tab_temp[signe];
|
||||||
|
}
|
||||||
|
int tab_val_inverse[10]={};
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
tab_val_inverse[tour]=tab_val[(9-tour)];
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val_inverse[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
37
DEV1.1/TP11/progression.c
Normal file
37
DEV1.1/TP11/progression.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int tour,tour2,val;
|
||||||
|
int t1[2][5];
|
||||||
|
int t2[3][5];
|
||||||
|
int t3[5][5];
|
||||||
|
for (tour=0;tour<2;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
t1[tour][tour2]=tour;
|
||||||
|
}
|
||||||
|
for (tour=0;tour<3;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
val=tour+tour2;
|
||||||
|
t2[tour][tour2]=val;
|
||||||
|
}
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
val=tour+tour2;
|
||||||
|
t3[tour][tour2]=val;
|
||||||
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
BIN
DEV1.1/TP11/recherche
Executable file
BIN
DEV1.1/TP11/recherche
Executable file
Binary file not shown.
35
DEV1.1/TP11/recherche.c
Normal file
35
DEV1.1/TP11/recherche.c
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe,valeur,indice=-1;
|
||||||
|
int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10};
|
||||||
|
srand(time(NULL));
|
||||||
|
for (tour=0;tour<10;tour++){
|
||||||
|
tab_val[tour]=rand()%51;
|
||||||
|
int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)};
|
||||||
|
signe=rand()%2;
|
||||||
|
tab_val[tour]=tab_temp[signe];
|
||||||
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("Donnez un entier qui se trouve dans le tableau : ");
|
||||||
|
scanf("%d",&valeur);
|
||||||
|
for (tour=0;tour<10;tour++){
|
||||||
|
if (valeur==tab_val[tour])
|
||||||
|
indice=tour;
|
||||||
|
}
|
||||||
|
printf("indice : %d \n",indice);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -5,22 +5,24 @@
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe;
|
int val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,tour,signe;
|
||||||
int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10};
|
int tab_val[10]={val1,val2,val3,val4,val5,val6,val7,val8,val9,val10};
|
||||||
|
srand(time(NULL));
|
||||||
for (tour=0;tour<10;tour++){
|
for (tour=0;tour<10;tour++){
|
||||||
srand(time(NULL));
|
|
||||||
tab_val[tour]=rand()%51;
|
tab_val[tour]=rand()%51;
|
||||||
int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)};
|
int tab_temp[2]={tab_val[tour],tab_val[tour]*(-1)};
|
||||||
srand(time(NULL));
|
signe=rand()%2;
|
||||||
signe==rand()%2;
|
|
||||||
tab_val[tour]=tab_temp[signe];
|
tab_val[tour]=tab_temp[signe];
|
||||||
}
|
}
|
||||||
printf("+");
|
printf("+");
|
||||||
for (tour=0;tour<10;tour++)
|
for (tour=0;tour<10;tour++)
|
||||||
printf("-----+");
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
printf("|");
|
printf("|");
|
||||||
for (tour=0;tour<10;tour++)
|
for (tour=0;tour<10;tour++)
|
||||||
printf("%3d |");
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
printf("+");
|
printf("+");
|
||||||
for (tour=0;tour<10;tour++)
|
for (tour=0;tour<10;tour++)
|
||||||
printf("-----+");
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
37
DEV1.1/TP12/progression.c
Normal file
37
DEV1.1/TP12/progression.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int tour,tour2,val;
|
||||||
|
int t1[2][5];
|
||||||
|
int t2[3][5];
|
||||||
|
int t3[5][5];
|
||||||
|
for (tour=0;tour<2;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
t1[tour][tour2]=tour;
|
||||||
|
}
|
||||||
|
for (tour=0;tour<3;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
val=tour+tour2;
|
||||||
|
t2[tour][tour2]=val;
|
||||||
|
}
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
for (tour2=1;tour2<6;tour2++)
|
||||||
|
val=tour+tour2;
|
||||||
|
t3[tour][tour2]=val;
|
||||||
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
printf("|");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("%4d |",tab_val[tour]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour=0;tour<10;tour++)
|
||||||
|
printf("-----+");
|
||||||
|
printf("\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user