Hi, I'm trying to make a program that prints a solid square of asterisks based on the side size entered by the user. The code builds fine but it doesn't work when I try to run the program. I get some code (looks like hex)? Please help!
#include <iostream>
#include <cmath>
using std::cin;
using std::cout;
using std::endl;
int main ()
{
int side;
int square(int side, int row, int col);
cout << "Please enter a positive integer for the side size of asterisk square required: \n";
cin >> side;
if (side <= 0) {
cout << side << " is not a positive integer. \nPlease enter a positive integer for the side size of asterisk square required: \n";
cin >> side;
}
else if (side > 0)
cout << square << endl;
return 0;
}
int square(int side, int row, int col)
{
for (col=0; col < side; col++){
cout << endl << endl;
for (row=0; row < side; row++){
cout << " * ";
}
}
return 0;
}