1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| #include <stdio.h>
#define W 4
#define ORGX 10
#define H 14
int main()
{
short X, Y, N, I, W1;
//Partie Haute
for(N=0; N<=H/2; N++)
{
//Partie Haute Gauche
X=ORGX-N;
printf("%*C", X, ' ');
for(I=0; I<W; I++)
printf("%C", '*');
//Partie Haute Droite
Y=2*N-W;
if(Y>0)
printf("%*C", Y, ' ');
else
W1=W+Y;
for(I=0; I<W1; I++)
printf("%C", '+');
printf("\n");
}
//Partie Basse
for(N=(H/2)+1; N<=H; N++)
{
//Partie Basse Gauche
X=N-W;
printf("%*C", X, ' ');
for(I=0; I<W; I++)
printf("%C", '*');
//Partie Basse Droite
Y=Y-2;
if(Y>0)
printf("%*C", Y, ' ');
else
W1=W+Y;
for(I=0; I<W1; I++)
printf("%C", '+');
printf("\n");
}
} |
Partager