Okay, here's my hollow square code, but why is it inserting asterisks in odd spots?
Code:#include <iostream> using namespace std; // begins program execution int main() { int side; // holds size of side of square int i,j; // holds counters; i = row and j = column cout << "Input the size of a side of a square (1-20): "; // asks user for size of the side cin >> side; // for top row for ( i = 0; i < side; ++i) { cout << "*"; } // for middle rows subtract 2 to adjust for first and last row for ( i = 0; i < ( side - 2 ); ++i) { cout << "*"; // subtract 2 to adjust for first and last columns for ( j = 0; j < ( side - 2 ); ++j) { cout << " "; } cout << "*" << endl; } // for bottom row for ( i = 0; i < side; ++i) { cout << "*"; } cout << endl; return 0; } // end main function