APL/APL1.1/TP15/decoupage.c
2021-10-18 16:28:46 +02:00

41 lines
662 B
C

#include<stdio.h>
#include<stdlib.h>
#define SIZE 10
void drawTriangle() {
for (int i = 0; i <= SIZE; i++) {
for (int i2 = SIZE-i; i2 > 0; i2--) printf(" ");
for (int i2 = 0; i2 < i*2-1; i2++) printf("* ");
printf("\n");
}
}
void drawSquare() {
for (int x = 0; x < SIZE; x++) {
for (int y = 0; y < SIZE; y++) {
printf("* ");
}
printf("\n");
}
}
int showMenu() {
int choice;
puts("Que voulez vous dessiner ?");
puts("1. Carré");
puts("2. Triangle");
scanf("%d", &choice);
return choice;
}
int main(int argc, char * argv[]) {
int choice = showMenu();
if(choice == 1) drawSquare();
else drawTriangle();
return EXIT_SUCCESS;
}