Skip to content

Instantly share code, notes, and snippets.

@CarlosRA97
Created November 10, 2017 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarlosRA97/107386c3a7fb7d120908ab70edf7ea92 to your computer and use it in GitHub Desktop.
Save CarlosRA97/107386c3a7fb7d120908ab70edf7ea92 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main() {
cout << "Enter the lentgh of the box: " << endl;
int boxSize = 0;
cin >> boxSize;
for (int row = 0; row < boxSize; row++) {
for (int col = 0; col < boxSize; col++) {
if (row == 0 or row == boxSize - 1) {
cout << "*";
} else {
if (col == 0 or col == boxSize - 1) {
cout << "*";
} else {
cout << " ";
}
}
}
cout << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment