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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <iostream>
#include <string>
using namespace std;
#include "triangle.h"
//
void printTriangleDetails(string label, const Triangle &tri)
{
cout << label << " triangle: [";
cout << tri.getSideA() << ", "
<< tri.getSideB() << ", "
<< tri.getSideC() << "]" << endl;
if (tri.isRightTriangle())
cout << " Triangle is a right triangle" << endl;
else
cout << " Triangle is not a right triangle" << endl;
// etc, etc, etc, for the other details about a triangle object
cout << endl; // end of details for this triangle
}
int main()
{
cout << "CSC2430 Triangle Lab: Written by: My Name" << endl;
Triangle t1;
printTriangleDetails("Default", t1);
Triangle t2(5, 4, 3);
printTriangleDetails("t2(5,4,3)", t2);
Triangle t3(4, 5, 3);
printTriangleDetails("t3(4,5,3)", t3);
Triangle t4(4, 6, 11);
printTriangleDetails("t4(4,0,4)", t4);
Triangle t5;
t5 = t4;
printTriangleDetails("Assigned t5=t4", t5);
t5 = Triangle(3, 3, 3);
printTriangleDetails("On-The-Fly assigned Triangle(3,3,3)", t5);
if (t5.isIsoscelesTriangle())
{
cout << "Triangle is an Isosceles Triangle;" << endl;
}
return 0;
}
|