Script started on Tue Sep 14 14:44:43 1999 strauss[2:44pm] [~/Class/cisc181/examples/]> cat 04-print-hollow-square.cc // Program takes as input an integer between 1 and 20 // and prints a hollow square made up of * and blanks // of the specified size // Exercise 2.28 from D&D #include main () { int size, col, row; // initialize size=0; // input square size -- make sure it is in bounds while (size < 1 || size > 20) { cout << "Input size of square (a number between 1 and 20): "; cin >> size; } cout << endl; // print top of square for (col = 1; col <= size; col++) cout << "*"; cout << endl; // print internal square lines for (row = 2; row <= size - 1; row++) { cout << "*"; for (col = 2; col <= size - 1; col++) cout << " "; cout << "*"; cout << endl; } // print bottom of square for (col = 1; col <= size; col++) cout << "*"; cout << endl; return 0; } strauss[2:44pm] [~/Class/cisc181/examples/]> CC 04-print-hollow-square.cc strauss[2:45pm] [~/Class/cisc181/examples/]> a.out Input size of square (a number between 1 and 20): 0 Input size of square (a number between 1 and 20): 73 Input size of square (a number between 1 and 20): 5 ***** * * * * * * ***** strauss[2:45pm] [~/Class/cisc181/examples/]> a.out Input size of square (a number between 1 and 20): 8 ******** * * * * * * * * * * * * ******** strauss[2:45pm] [~/Class/cisc181/examples/]> exit strauss[2:46pm] [~/Class/cisc181/examples/]> exit script done on Tue Sep 14 14:46:15 1999