<分区>
#include <iostream>
using namespace std;
int mf_option(1);
int mf_rectangle(2);
int main()
{
int mf_option(1);
int mf_rectangle(2);
return 0;
}
int mf_option(1)
{
char a;
int size = 0;
cout << "Enter a character: " << endl;
cin >> a;
while (size < 1 || size > 5)
cout << "Enter a valid size from 1-5: " << endl;
cin >> size;
}
int mf_rectangle(2)
{
int size = 0;
for (int row = 1; row <= size; row++)
{
for (int col = 1; col <= size; col++)
{
if (row > 1 && row < size && col > 1 && col < size)
cout << " ";
else
cout << a;
}
cout << "\n\n";
}
for (int row = 2; row <= size; row++)
{
for (int col = 2; col <= size; col++)
{
if (row > 2 && row < size && col > 2 && col < size)
cout << " ";
else
cout << a;
}
cout << "\n\n";
}
for (int row = 3; row <= size; row++)
{
for (int col = 3; col <= size; col++)
{
if (row > 3 && row < size && col > 3 && col < size)
cout << " ";
else
cout << a;
}
cout << "\n\n";
}
for (int row = 4; row <= size; row++)
{
for (int col = 4; col <= size; col++)
{
if (row > 4 && row < size && col > 4 && col < size)
cout << " ";
else
cout << a;
}
cout << "\n\n";
}
for (int row = 5; row <= size; row++)
{
for (int col = 5; col <= size; col++)
{
if (row > 5 && row < size && col > 5 && col < size)
cout << " ";
else
cout << a;
}
cout << "\n\n";
}
}
我不明白为什么我会在第 15 行和第 26 行收到此错误。第 15 行还有一个错误,上面写着预期的“;”。这是错误信息 错误 1 error C2448: 'mf_option1' : 函数式初始化器似乎是一个函数定义