diff options
Diffstat (limited to '8b/9.14.1Knox/9.14.1Knox.cpp')
| -rw-r--r-- | 8b/9.14.1Knox/9.14.1Knox.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/8b/9.14.1Knox/9.14.1Knox.cpp b/8b/9.14.1Knox/9.14.1Knox.cpp new file mode 100644 index 0000000..adf6a66 --- /dev/null +++ b/8b/9.14.1Knox/9.14.1Knox.cpp @@ -0,0 +1,73 @@ +// 9.14.1Knox.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include <iostream> +using namespace std; + +void GetInput(int&, int&); +void PrintBox(int, int); + +int main() +{ + int width, height; + + GetInput(height, width); + PrintBox(height, width); +} + +void GetInput(int& height, int& width) +{ + cout << "Input the hieght of the box in charcters: "; + cin >> height; + + cout << "\nInput the width of the box in charcters: "; + cin >> width; + cout << "\n\n"; + + return; +} + +void PrintBox(int height, int width) +{ + for (int y = 1; y <= height; y++) + { + for (int x = 1; x <= width; x++) + { + char out; + if (x == 1 && y == 1) + { + out = (char) 218; + } + else if (x == width && y == 1) + { + out = (char) 191; + } + else if (y == height && x == 1) + { + out = (char) 192; + } + else if (y == height && x == width) + { + out = (char) 217; + } + else + { + if (y == 1 || y == height) + { + out = (char) 196; + } + else if (x == 1 || x == width) + { + out = (char) 179; + } + else + { + out = ' '; + } + } + + cout << out; + } + cout << endl; + } +}
\ No newline at end of file |