编写一个c语言程序,打印输出下列雪花图案。。急求!谢谢!!!
发布网友
发布时间:2022-05-11 16:02
我来回答
共2个回答
热心网友
时间:2023-10-14 18:01
#include <stdio.h>
void main()
{
for (int i = 1; i <= 13; i++)
{
switch (i)
{
case 1:
printf(" *\n");
break;
case 2:
printf("\n");
break;
case 3:
printf(" * * * *\n");
break;
case 4:
printf("\n");
break;
case 5:
printf(" * * *\n");
break;
case 6:
printf("\n");
break;
case 7:
printf("* * * * * *\n");
break;
case 8:
printf("\n");
break;
case 9:
printf(" * * *\n");
break;
case 10:
printf("\n");
break;
case 11:
printf(" * * * *\n");
break;
case 12:
printf("\n");
case 13:
printf(" *\n");
break;
default:
break;
}
}
return;
}
一行一行写的,VS 2008下编译调试测试通过,求采纳!
热心网友
时间:2023-10-14 18:01
#include <stdio.h>
int main()
{
char image[13][12] = {
{" * "},
{" "},
{" * * * * "},
{" "},
{" * * * "},
{" "},
{"* * * * * *"},
{" "},
{" * * * "},
{" "},
{" * * * * "},
{" "},
{" * "}
};
for (int i = 0; i < 13; i++){
for (int j = 0; j < 11; j++){
printf("%c", image[i][j]);
}
printf("\n");
}
return 0;
}