emmmm


私信TA

用户名:130

访问量:12867

签 名:

1000年前,我是为了什么来到地球呢?

等  级
排  名 1581
经  验 2770
参赛次数 0
文章发表 16
年  龄 20
在职情况 学生
学  校 超神学院
专  业 弑神

  自我简介:

请叫我码农


解题思路:

注意事项:

参考代码:

#include<stdio.h>
void Paint(unsigned long  a,int i)
{
    char zeno[5][4]={"***","* *","* *","* *","***"};
    char one[5][4]={"  *","  *","  *","  *","  *"};
    char two[5][4]={"***","  *","***","*  ","***"};
    char three[5][4]={"***","  *","***","  *","***"};
    char four[5][4]={"* *","* *","***","  *","  *"};
    char five[5][4]={"***","*  ","***","  *","***"};
    char six[5][4]={"***","*  ","***","* *","***"};
    char seven[5][4]={"***","  *","  *","  *","  *"};
    char eight[5][4]={"***","* *","***","* *","***"};
    char nine[5][4]={"***","* *","***","  *","***"};
 	switch(a)
	{
		case 0:
				printf("%s",zeno[i]);
		break;
		case 1:
				printf("%s",one[i]);
		break;
		case 2:
				printf("%s",two[i]);
		break;
		case 3:
				printf("%s",three[i]);
		break;
		case 4:
				printf("%s",four[i]);
		break;
		case 5:
				printf("%s",five[i]);
		break;
		case 6:
				printf("%s",six[i]);
		break;
		case 7:
				printf("%s",seven[i]);
		break;
		case 8:
				printf("%s",eight[i]);
		break;
		case 9:
				printf("%s",nine[i]);
		break;
	}
}
int main()
{
	unsigned long n;
	int N[20],i,j,m,flag;
	char zeno[5][4]={"***","* *","* *","* *","***"};
	while(scanf("%ul",&n)!=EOF)
	{
		flag=0;
		if(n==0)//别忘了0
		{
			flag=1;
			for(i=0;i<5;i++)
			{
			 	printf("%s\n",zeno[i]);
			}	
		}
		i=0;
		while(n!=0)//求出每一位数字
		{
			N[i]=n%10;
			n=n/10;
			i++;
		}
		m=i;
		for(i=0;i<5;i++)
		{
			for(j=m-1;j>=0;j--)
			{
				Paint(N[j],i);
				if(j!=0)//数字和数字之间空一列
				printf(" ");
			}
			if(flag==0)
			printf("\n");
		}
	}
	return 0;
}


 

0.0分

0 人评分

  评论区

  • «
  • »