Fin TP10
This commit is contained in:
39
DEV1.1/TP09/tests.c
Normal file
39
DEV1.1/TP09/tests.c
Normal file
@@ -0,0 +1,39 @@
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int hauteur;
|
||||
char choix;
|
||||
int i;
|
||||
int j;
|
||||
printf("_______________\n t) Triangle\n c) Carré\n q) Quitter\n Votre choix ? ");
|
||||
choix = getchar();
|
||||
while (choix != 'q') {
|
||||
printf("\n\nHauteur ? ");
|
||||
scanf("%d", &hauteur);
|
||||
if (choix == 't') {
|
||||
for (i = 0; i != hauteur; i++) {
|
||||
for (j = 0; j != i; j++) {
|
||||
printf("*");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i != hauteur; i++) {
|
||||
printf("*");
|
||||
}
|
||||
printf("\n");
|
||||
for (i = 0; i != (hauteur - 2); i++) {
|
||||
printf("*");
|
||||
for (j = 0; j != (hauteur - 2); j++) {
|
||||
printf(" ");
|
||||
}
|
||||
printf("*\n");
|
||||
}
|
||||
}
|
||||
printf("_______________\n t) Triangle\n c) Carré\n q) Quitter\n Votre choix ? ");
|
||||
choix = getchar();
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user