Equilateral Triangles

So, here’s the code for the first part my big massive triangle calculater. THis will be incorporated later into a much bigger project, but for now ENJOY!

#include "iostream"
#include "math.h"
//calculates perimeter, the value of the sides times 3
float Eq_Perimeter(int a)
{
    return a*3;
}
//calculates semiperimeter.
float Eq_Semiperimeter(int a)
{
    return (a*3)/2;
}
//Calculates Area.
float Eq_Area (int a)
{
    return pow(a,2)*(sqrt(3)/4);
}
//Calculates Altitude.
float Eq_Altitude (int a)
{
    return a*(sqrt(3)/2);
}
//Calculates the Medians.
float Eq_Median (int a)
{
    return a*(sqrt(3)/2);
}
//Calculates the Angle Bisectors.
float Eq_Angle_Bisector (int a)
{
    return a*(sqrt(3)/2);
}
//Calculates the radius of a circle that is circumscribed on the triangle.
float Eq_Circum_Radius (int a)
{
    return a*(sqrt(3)/3);
}
//Calculates the radius of a circle that is inscribed on the triangle.
float Eq_Inscr_Radius (int a)
{
    return a*(sqrt(3)/6);
}
int Main()
{
        using namespace std;
    cout << "Please enter the value of each side: " << endl;
    int a;
    cin >> a;
    cout << "The Perimeter is: "
    << Eq_Perimeter(a) << endl;
    cout << "The Semiperimeter is: "
    << Eq_Semiperimeter(a) << endl;
    cout << "The Area is: "
    << Eq_Area (a) << endl;
    cout << "The Altitude of each side is: "           
    << Eq_Altitude (a) << endl;
    cout << "The Median of each side is: "
    << Eq_Median (a) << endl;
    cout << "The Angle Bisector of each angle is: "    
    << Eq_Angle_Bisector (a) << endl;
    cout << "The Radius of a Circumscribed Circle is: "
    << Eq_Circum_Radius (a) << endl;
    cout << "The Radius of an Inscribed Circle is: "
    << Eq_Inscr_Radius (a) << endl;
    return 0;
}

~ by aeriondyseti on October 11, 2009.

Leave a Reply