From f5f18ba79eab943bf486b229dafc6b7759030b32 Mon Sep 17 00:00:00 2001 From: BensProgramma <91996773+BensProgramma@users.noreply.github.com> Date: Tue, 26 Oct 2021 23:06:15 -0700 Subject: Update CST116F2021-Lab4.cpp --- CST116F2021-Lab4/CST116F2021-Lab4.cpp | 52 ++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'CST116F2021-Lab4/CST116F2021-Lab4.cpp') 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 +#include +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