第一次发帖子,大家多多支持啊
/* *
* *
* *
* *
* *
* *
*
*/
#include<stdio.h>
int main(){
int i = 6;
int x = 8;
int j, y;
int m = 0;
int n = 2;
int a ,b;
for (int h = 1; h <= 7; h++) {
if (h <= 4){
j = i++;
y = x--;
for (int l = 1; l <= h + j; l++) {
if (l == h + j) {
printf("*");
}else if(l == y- h){
printf("*");
}else{
printf(" ");
}
}
printf("\n");
}
else{
a = m++;
b = n--;
for (int l = 1; l <= 16 - h - a; l++) {
if (l == 16 - h - a) {
printf("*");
}else if(h == l + b){
printf("*");
}else{
printf(" ");
}
}
printf("\n");
}
}
return 0;
} |
|