-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectAreaComparison.cpp
More file actions
40 lines (30 loc) · 881 Bytes
/
RectAreaComparison.cpp
File metadata and controls
40 lines (30 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//CSC114-651
//Student: Christopher Yonek (700642859)
//Assignment: Create a program that calculates area of two rectangles and checks which is greater.
//Date: September 2018
#include "pch.h"
#include <iostream>
#include <iomanip>
#include <conio.h>
#include <cmath>
using namespace std;
int main()
{
double widthRect1, lengthRect1;
double widthRect2, lengthRect2;
cout << "Enter the width and length of triangle 1: \n";
cin >> widthRect1;
cin >> lengthRect1;
cout << "Enter the width and length of triangle 2: \n";
cin >> widthRect2;
cin >> lengthRect2;
if (widthRect1 * lengthRect1 > widthRect2 * lengthRect2)
cout << "Triangle 1 has greater area!";
else if (widthRect1 * lengthRect1 < widthRect2 * lengthRect2)
cout << "Triangle 2 has greater area!";
else {
cout << "The areas of the two are equal.";
}
_getch();
return 0;
}