aboutsummaryrefslogtreecommitdiff
path: root/8b/9.14.1Knox/9.14.1Knox.cpp
diff options
context:
space:
mode:
authorJacobAKnox <[email protected]>2021-10-23 09:53:44 -0700
committerJacobAKnox <[email protected]>2021-10-23 09:53:44 -0700
commitc790cb06242c72a10e2e01036b9de7cc37088763 (patch)
tree258139a7b56f8d6126721d5073c83e57957d3b2d /8b/9.14.1Knox/9.14.1Knox.cpp
parent7c finished (diff)
downloadcst116-lab4-jacobaknox-master.tar.xz
cst116-lab4-jacobaknox-master.zip
8a and 8bHEADmaster
Diffstat (limited to '8b/9.14.1Knox/9.14.1Knox.cpp')
-rw-r--r--8b/9.14.1Knox/9.14.1Knox.cpp73
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