2021-03-27 15:33:25 -04:00

55 lines
1.0 KiB
C++

/*
Example input:
3.0 4.0
4.0 5.0
Example output:
Triangle with larger area:
Base: 4.00
Height: 5.00
Area: 10.00
*/
#include <iostream>
#include "Triangle.h"
using namespace std;
int main(int argc, const char* argv[]) {
Triangle triangle1;
Triangle triangle2;
// TODO: Read and set base and height for triangle1 (use SetBase() and SetHeight())
string userInput;
cin >> userInput;
triangle1.SetBase(stod(userInput));
cin >> userInput;
triangle1.SetHeight(stod(userInput));
// TODO: Read and set base and height for triangle2 (use SetBase() and SetHeight())
cin >> userInput;
triangle2.SetBase(stod(userInput));
cin >> userInput;
triangle2.SetHeight(stod(userInput));
// TODO: Determine larger triangle (use GetArea())
cout << "Triangle with larger area:" << endl;
if (triangle1.GetArea() > triangle2.GetArea()){
triangle1.PrintInfo();
}
else{
triangle2.PrintInfo();
}
// TODO: Output larger triangle's info (use PrintInfo())
return 0;
}