diff options
| author | BensProgramma <[email protected]> | 2021-10-26 23:06:15 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-26 23:06:15 -0700 |
| commit | f5f18ba79eab943bf486b229dafc6b7759030b32 (patch) | |
| tree | 2d10022a1480c13a53e3d9b069aa426edab6ac8b /CST116F2021-Lab4 | |
| parent | Update RunFromLab4_Schroeder.txt (diff) | |
| download | cst116-lab4-bensprogramma-f5f18ba79eab943bf486b229dafc6b7759030b32.tar.xz cst116-lab4-bensprogramma-f5f18ba79eab943bf486b229dafc6b7759030b32.zip | |
Update CST116F2021-Lab4.cpp
Diffstat (limited to 'CST116F2021-Lab4')
| -rw-r--r-- | CST116F2021-Lab4/CST116F2021-Lab4.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/CST116F2021-Lab4/CST116F2021-Lab4.cpp b/CST116F2021-Lab4/CST116F2021-Lab4.cpp index d034256..da7a509 100644 --- a/CST116F2021-Lab4/CST116F2021-Lab4.cpp +++ b/CST116F2021-Lab4/CST116F2021-Lab4.cpp @@ -282,10 +282,60 @@ void displayTime(int hour,int min,int sec,int F) //Function to display the //} // // -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +*/ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* +9.14_1 Programming exercises + Draw A rectangle +*/ +/* +#include <iostream> +#include<string> +using namespace std; +void DrawRect(int,int); +int main() // Program to draw a rectangle on the screen of user defined dimensions +{ + int height = 0; + int width = 0; + cout << "Enter the dimensions of the rectangle I'm going to print on the screen\n"; + cout << "Height: "; + cin >> height; + cout << "Width: "; + cin >> width; + + DrawRect(height, width); + + return 0; +} + +void DrawRect(int height,int width) //Function that draws the rectangle +{ + //Top + string top(width,char(196)); + top[0] = char(218); + top[width-1] = char(191); + cout << top<<"\n"; + + //Sides + string sides(width, char(32)); + for (int i=1; i<height-2;i++) + { + sides[0] = char(179); + sides[width-1] =char(179); + cout << sides<<"\n"; + } + + //Bottom + string bottom(width, char(196)); + bottom[0] = char(192); + bottom[width-1] = char(217); + cout << bottom; +} +*/ |