标签:des style blog http io color ar sp for
1 #include <stdio.h> 2 3 int main(){ 4 int n; 5 char c; 6 int length; 7 int flag[100][100]; 8 int i; 9 int j; 10 int a; 11 int b; 12 int temp; 13 int print; 14 15 print=0; 16 17 while(1){ 18 scanf("%c",&c); 19 20 if(c==‘@‘) 21 break; 22 23 if(print==1) 24 printf("\n"); 25 26 scanf("%d",&n); 27 getchar(); 28 length=2*n-1; 29 30 for(i=0;i<100;i++){ 31 for(j=0;j<100;j++){ 32 flag[i][j]=0; 33 } 34 } 35 36 a=0; 37 b=length-1; 38 for(i=n-1;i>=0;i--){ 39 flag[i][a]=1; 40 flag[i][b]=1; 41 a++; 42 b--; 43 } 44 45 for(j=0;j<length;j++){ 46 flag[n-1][j]=1; 47 } 48 49 temp=n; 50 print=1; 51 for(i=0;i<n;i++){ 52 for(j=0;j<temp;j++){ 53 if(flag[i][j]==1) 54 printf("%c",c); 55 56 else 57 printf(" "); 58 } 59 printf("\n"); 60 temp++; 61 } 62 } 63 return 0; 64 }
标签:des style blog http io color ar sp for
原文地址:http://www.cnblogs.com/zqxLonely/p/4093916.html