cout << "This program calculates the area of a triangle";
cout << "What is the length of side A, B, and C, respectively?";
cin >> A >> B >> C;
cout << "The perimeter of the triangle is" << left << setw(8) << perimeter << endl;
cout << "The area of the triangle is " << left << setw(8) << area << endl;
return 0;
}
//Herons Formula
#include <cmath>
#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
double area, perimeter, s;
double A, B, C; //should not be char. Double, float or int will interpret the input as a number.
perimeter= A+B+C;
s= perimeter/2;
area= sqrt(s*(s-A)*(s-B)*(s-C));
cout << "This program calculates the area of a triangle";
cout << "What is the length of side A, B, and C, respectively?";
cin >> A >> B >> C;
perimeter= A+B+C; //Do this only after setting A, B and C
s= perimeter/2; //Otherwise the values are not set when calculated.
area= sqrt(s*(s-A)*(s-B)*(s-C));
cout << "The perimeter of the triangle is" << left << setw(8) << perimeter << endl;
cout << "The area of the triangle is " << left << setw(8) << area << endl;
return 0;
}
Thank you very much for your help. Check it out I finally finished it with ur help, however I am dealing with more complicated things and I am stuck here: