Fin Ex 1
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
#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/TP12/progression
Executable file
BIN
DEV1.1/TP12/progression
Executable file
Binary file not shown.
@@ -3,35 +3,139 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int tour,tour2,val;
|
int tour,tour2,val=0,val1=0,val2=0;
|
||||||
int t1[2][5];
|
int t1[2][5];
|
||||||
int t2[3][5];
|
int t2[3][5];
|
||||||
int t3[5][5];
|
int t3[5][5];
|
||||||
|
int t1_inv[5][2];
|
||||||
|
int t2_inv[5][3];
|
||||||
|
int t3_inv[5][5];
|
||||||
for (tour=0;tour<2;tour++){
|
for (tour=0;tour<2;tour++){
|
||||||
for (tour2=1;tour2<6;tour2++)
|
for (tour2=0;tour2<5;tour2++)
|
||||||
t1[tour][tour2]=tour;
|
t1[tour][tour2]=tour2+1;
|
||||||
}
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<2;tour++){
|
||||||
|
printf("|");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("%2d |",t1[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
for (tour=0;tour<3;tour++){
|
for (tour=0;tour<3;tour++){
|
||||||
for (tour2=1;tour2<6;tour2++)
|
for (tour2=0;tour2<5;tour2++){
|
||||||
val=tour+tour2;
|
val++;
|
||||||
t2[tour][tour2]=val;
|
t2[tour][tour2]=val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<3;tour++){
|
||||||
|
printf("|");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("%2d |",t2[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
for (tour=0;tour<5;tour++){
|
for (tour=0;tour<5;tour++){
|
||||||
for (tour2=1;tour2<6;tour2++)
|
for (tour2=0;tour2<5;tour2++){
|
||||||
val=tour+tour2;
|
if ((tour2+1)<=tour)
|
||||||
t3[tour][tour2]=val;
|
t3[tour][tour2]=tour2+1;
|
||||||
|
else
|
||||||
|
t3[tour][tour2]=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf("+");
|
printf("+");
|
||||||
for (tour=0;tour<10;tour++)
|
for (tour2=0;tour2<5;tour2++)
|
||||||
printf("-----+");
|
printf("---+");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("|");
|
for (tour=0;tour<5;tour++){
|
||||||
for (tour=0;tour<10;tour++)
|
printf("|");
|
||||||
printf("%4d |",tab_val[tour]);
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("%2d |",t3[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
for (tour2=0;tour2<2;tour2++)
|
||||||
|
t1_inv[tour][tour2]=tour+1;
|
||||||
|
}
|
||||||
printf("+");
|
printf("+");
|
||||||
for (tour=0;tour<10;tour++)
|
for (tour2=0;tour2<2;tour2++)
|
||||||
printf("-----+");
|
printf("---+");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return EXIT_SUCCESS;
|
for (tour=0;tour<5;tour++){
|
||||||
|
printf("|");
|
||||||
|
for (tour2=0;tour2<2;tour2++)
|
||||||
|
printf("%2d |",t1_inv[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<2;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
val1++;
|
||||||
|
for (tour2=0;tour2<3;tour2++){
|
||||||
|
t2_inv[tour][tour2]=val1+(5*tour2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<3;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
printf("|");
|
||||||
|
for (tour2=0;tour2<3;tour2++)
|
||||||
|
printf("%2d |",t2_inv[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<3;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
val2++;
|
||||||
|
for (tour2=0;tour2<5;tour2++){
|
||||||
|
if ((tour2)>tour)
|
||||||
|
t3_inv[tour][tour2]=val2;
|
||||||
|
else
|
||||||
|
t3_inv[tour][tour2]=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
for (tour=0;tour<5;tour++){
|
||||||
|
printf("|");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("%2d |",t3_inv[tour][tour2]);
|
||||||
|
printf("\n");
|
||||||
|
printf("+");
|
||||||
|
for (tour2=0;tour2<5;tour2++)
|
||||||
|
printf("---+");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user