#mark - 72数组练习之二维数组
用一个二维数组打印图形
*
***
*****
*******
#include<stdio.h>
int main()
{
char arr[4][7] =
{
{' ',' ',' ','*',' ',' ',' '},
{' ',' ','*','*','*',' ',' '},
{' ','*','*','*','*','*',' '},
{'*','*','*','*','*','*','*'},
};
for(int i = 0; i<4 ;i++)
{
for(int j = 0; j<7 ;j++)
{
printf("%c",arr[i][j]);
}
printf("\n");
}
return 0;
}
arr[0][0] arr[0][1] arr[0][2] arr[0][3]
arr[1][0] ....
#include <stdio.h>
int main()
{
int a[4][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},
};
//遍历二维数组打印星星
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 7; j++) {
if(a[i][j]==0)
|
|