So far this is my code; I'm supposed to write a program with two overloaded functions both named triangleArea. In main, randomly ask the user to enter either base and height or the lengths of the three sides and then make the appropriate call to triangleArea. triangleArea should return the area to main where it will be displayed.
code
{
#include <iostream>
using namespace std;
// function prototype
double triangleArea(int base, int height); // Calculates area when given base and height
double triangleArea(int length1, int length2, int length3); // Calculates area when given 3 side lengths
int main()
{
int height;
int base;
char choice;
int length1;
int length2;
int length3;
do
{
cout << "Enter base and height of a triangle " << endl;
cin >> base >> height;
triangleArea(base, height);
double triangleArea(int base, int height)
{
int ba;
int he;
double area = (ba * he) * (0.5);
return area;
}
double triangleArea(int length1, int length2, int length3)
{
int length1;
int length2;
int length3;
double total = (length1 + length2 + length3) / 2;
return total;
}