问题遇到的现象和发生背景
#include<iostream>
using namespace std;
void line1(int x,char y)
{
int i = 1;
for (i;i <= x;i++)
{
cout << y;
}
cout << endl;
}
void line2(int x, char y)
{
int i = 1;
for (;i <= x;i++)
{
while (i >= 1 && i < (x / 2 + 1))
{
cout << " ";
}
while (i = (x / 2 + 1))
{
cout << y;
}
}
cout << endl;
}
void change(int x, char y)
{
int i ;
for (i=1;i <= x;i++)
{
while (i == 1)
{
line1(x, y);
}
while ((i > 1) && (i < x / 2 + 1))
{
line2(x, y);
}
while (i == x / 2 + 1)
{
line1(x, y);
}
while ((i > x / 2 + 1) && (i < x))
{
line2(x, y);
}
while (i = x)
{
line1(x, y);
}
while(i > x)
{
break;
}
}
}
int main()
{
int a=4;
char b;
cout << "汉字以多少点阵方式显示,16 * 16输入16, 32 * 32输入32,依次类推:" << endl;
cin >> a;
cout << "请输入构成汉字的基本字符号是:" << endl;
cin >> b;
change(a, b);
}
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果