使用数组实现多行输出的程序,输出内容为用数组实现多行输出的程序.出内容为

来源:百度知道 编辑:UC知道 时间:2024/06/08 09:55:00

不懂你所说的使用数组实现是什么意思,我按照我的理解作了:

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
unsigned char pr[7][7] = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
};
int i, j;

for (i = 0; i < 7; i++)
{
for (j = 0; j < 7; j++)
{
if (pr[i][j] == 0)
{
putchar(' ');
}
else
{
putchar('*');
}
}
putchar('\n');
}
return 0;
}