// Programming Technique II (SECJ1023)
// Semester 2, 2020/2021
// Tutorial 2: Procedural Programming (PP) vs. Object-Oriented Programming (OOP)
// Program 2: Using structured data type
// Megat Irfan Zackry (A20EC0205)

#include <iostream>
#include <iomanip>
using namespace std;

struct Rectangle {
	int width, height;
};

void drawRectangle(Rectangle r)
{
	for (int i=0; i < r.width; i++){
		cout << "-";
	}
	for (int i=0; i < r.height; i++){
		cout << endl << ":" << setw(r.width) << ":" << endl;
	}
	cout << endl;
	for (int i=0; i < r.width; i++){
		cout << "-";
	}
}

void calcRectangleArea(Rectangle r)
{
	int area = r.width * r.height;
	cout << endl << endl << "Rectangle area is = " << area;
}

int main()
{
	Rectangle r;
	r.width = 30, r.height = 5;		
	cout << "This rectangle of width = " << r.width << " and height = " << r.height << endl << endl;
	drawRectangle(r);
	calcRectangleArea(r);
	return 0;
}
