#include #include #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"); puts("3. Quitter"); scanf("%d", &choice); return choice; } int main(int argc, char * argv[]) { int choice; do { choice = showMenu(); if (choice == 1) drawSquare(); else if (choice == 2) drawTriangle(); else if (choice != 3) puts("Choix incorrect."); } while (choice != 3); return EXIT_SUCCESS; }