123456789101112131415 |
- /* Create a function that creates a box based on dimension n.
- */
- std::vector<std::string> makeBox(int n) {
- // n represents the height of the box and length
- std::vector<std::string> thebox;
- for (int i=0;i<n;i++){
- // creates an array of strings based on "n"
- thebox.push_back(std::string(n,'#'));
- // modify the middle rows by replacing the center characters
- if((i>0) && (i < (n-1))){
- thebox[i].replace (1, n-2, n-2, ' ');
- }
- }
- return thebox;
- }
|