二维数组输出字符字母
#include <iostream>
using namespace std
;
int main()
{
int a
[7][7] = {
{1,1,1,1,1,1,1},
{0,0,0,0,0,1,0},
{0,0,0,0,1,0,0},
{0,0,0,1,0,0,0},
{0,0,1,0,0,0,0},
{0,1,0,0,0,0,0},
{1,1,1,1,1,1,1}
};
int b
[7][7] = {
{1,0,0,0,0,0,1},
{0,1,0,0,0,1,0},
{0,0,1,0,1,0,0},
{0,0,0,1,0,0,0},
{0,0,1,0,1,0,0},
{0,1,0,0,0,1,0},
{1,0,0,0,0,0,1}
};
for (int i
= 0;i
< 7;i
++)
{
for (int j
= 0;j
< 7;j
++)
{
if (a
[i
][j
] == 1)
{
cout
<< "*";
}
else
{
cout
<< " ";
}
}
cout
<< endl
;
}
cout
<< endl
;
for (int i
= 0;i
< 7;i
++)
{
for (int j
= 0;j
< 7;j
++)
{
if (a
[i
][j
] == 1)
{
cout
<< "*";
}
else
{
cout
<< " ";
}
}
cout
<< endl
;
}
cout
<< endl
;
for (int i
= 0;i
< 7;i
++)
{
for (int j
= 0;j
< 7;j
++)
{
if (b
[i
][j
] == 1)
{
cout
<< "*";
}
else
{
cout
<< " ";
}
}
cout
<< endl
;
}
system("pause");
return 0;
}
转载自:黑凤梨の博客
转载请注明原文地址:https://blackberry.8miu.com/read-8086.html