Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
void line( int size, char border, char middle)
{
std::cout << border;
for(int i = 0; i < size - 2; i++)
std::cout << middle;
std::cout << border << '\n';
}
int main(void)
{
int size = 0;
while
(
std::cout << "Enter the size of the square: " and
std::cin >> size and
size > 100
)
{
std::cout << "Too big\n";
}
line(size, '+', '-');
for (int i = 0; i < size - 2; i++)
line(size, '|', ' ');
line(size, '+', '-');
return 0;
}
| |
I forgot to mention, sorry. As you can see, sorry is not necessary. You should have initialized it.
Last edited on
I'm glad he/she got the answer they wanted.
It's over to the teacher to see how many turn it in. I might be the teacher ... :)