diff --git a/DEV1.1/TP12/horizontal.c b/DEV1.1/TP12/horizontal.c deleted file mode 100644 index feced1f..0000000 --- a/DEV1.1/TP12/horizontal.c +++ /dev/null @@ -1,199 +0,0 @@ -#include -#include -#include - -int main(void) { - int tour,tour2,val=0,val1=0,val2=0; - int t1[2][5]; - int t2[3][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 (tour2=0;tour2<5;tour2++) - t1[tour][tour2]=tour2+1; - } - for (tour=0;tour<3;tour++){ - for (tour2=0;tour2<5;tour2++){ - val++; - t2[tour][tour2]=val; - } - } - for (tour=0;tour<5;tour++){ - for (tour2=0;tour2<5;tour2++){ - if ((tour2+1)<=tour) - t3[tour][tour2]=tour2+1; - else - t3[tour][tour2]=0; - } - } - for (tour=0;tour<5;tour++){ - for (tour2=0;tour2<2;tour2++) - t1_inv[tour][tour2]=tour+1; - } - for (tour=0;tour<5;tour++){ - val1++; - for (tour2=0;tour2<3;tour2++){ - t2_inv[tour][tour2]=val1+(5*tour2); - } - } - 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; - } - } - for (tour=0;tour<3;tour++){ - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf(" "); - } - printf("+"); - for (tour2=0;tour2<2;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<3;tour2++) - printf("---+"); - printf(" "); - 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(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t2[tour][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3[tour][tour2]); - printf(" "); - } - printf("|"); - for (tour2=0;tour2<2;tour2++) - printf("%2d |",t1_inv[tour][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<3;tour2++) - printf("%2d |",t2_inv[tour][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3_inv[tour][tour2]); - printf("\n"); - for (tour=0;tour<3;tour++){ - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf(" "); - } - printf("+"); - for (tour2=0;tour2<2;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<3;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf("\n"); - } - for (tour2=0;tour2<5;tour2++) - printf(" "); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t2[2][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3[2][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<2;tour2++) - printf("%2d |",t1_inv[2][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<3;tour2++) - printf("%2d |",t2_inv[2][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3_inv[2][tour2]); - printf("\n"); - for (tour=0;tour<3;tour++){ - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf(" "); - } - printf("+"); - for (tour2=0;tour2<2;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<3;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf("\n"); - for (tour=3;tour<5;tour++){ - for (tour2=0;tour2<5;tour2++){ - printf(" "); - printf(" "); - for (tour2=0;tour2<5;tour2++){ - printf(" "); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3[tour][tour2]); - printf(" "); - } - printf("|"); - for (tour2=0;tour2<2;tour2++) - printf("%2d |",t1_inv[tour][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<3;tour2++) - printf("%2d |",t2_inv[tour][tour2]); - printf(" "); - printf("|"); - for (tour2=0;tour2<5;tour2++) - printf("%2d |",t3_inv[tour][tour2]); - printf("\n"); - for (tour=0;tour<3;tour++){ - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf(" "); - } - printf("+"); - for (tour2=0;tour2<2;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<3;tour2++) - printf("---+"); - printf(" "); - printf("+"); - for (tour2=0;tour2<5;tour2++) - printf("---+"); - printf("\n"); - } - printf("\n"); - return EXIT_SUCCESS; -} \ No newline at end of file diff --git a/DEV1.1/TP12/horizontal2 b/DEV1.1/TP12/horizontal2 new file mode 100755 index 0000000..061d205 Binary files /dev/null and b/DEV1.1/TP12/horizontal2 differ diff --git a/DEV1.1/TP12/horizontal2.c b/DEV1.1/TP12/horizontal2.c new file mode 100644 index 0000000..d176e9c --- /dev/null +++ b/DEV1.1/TP12/horizontal2.c @@ -0,0 +1,56 @@ +#include +#include +#include + +int main(void) { + int tour,tour2,val=0,val1=0,val2=0; + int t1[2][5]; + int t2[3][5]; + int t3[5][5]; + for (tour=0;tour<2;tour++){ + for (tour2=0;tour2<5;tour2++) + t1[tour][tour2]=tour2+1; + } + for (tour=0;tour<3;tour++){ + for (tour2=0;tour2<5;tour2++){ + val++; + t2[tour][tour2]=val; + } + } + for (tour=0;tour<5;tour++){ + for (tour2=0;tour2<5;tour2++){ + if ((tour2+1)<=tour) + t3[tour][tour2]=tour2+1; + else + t3[tour][tour2]=0; + } + } + for (tour=0;tour<5;tour++){ + for (tour2=0;tour2<17;tour2++){ + if (tour<2){ + if (tour2<5) + printf("%2d ",t1[tour][tour2]); + else if (tour2>5 && tour2<11) + printf("%2d ",t2[tour][tour2-6]); + else if (tour2>11) + printf("%2d ",t3[tour][tour2-12]); + else + printf(" "); + } else if (tour<3){ + if (tour2>5 && tour2<11) + printf("%2d ",t2[tour][tour2-6]); + else if (tour2>11) + printf("%2d ",t3[tour][tour2-12]); + else + printf(" "); + } else{ + if (tour2>11) + printf("%2d ",t3[tour][tour2-12]); + else + printf(" "); + } + } + printf("\n"); + } + return EXIT_SUCCESS; +} \ No newline at end of file