Answers

2013-12-28T20:32:40+08:00
#include <iostream>
#include <math.h>
using namespace std;
float Heron(float a, float b, float c){
    float p=(a+b+c)/2;
    return sqrt(p*(p-a)*(p-b)*(p-c));
}
int main(){
    float a,b,c;
    cout << "Enter a: ";
    cin >> a;
    cout << "Enter b: ";
    cin >> b;
    cout << "Enter c: ";
    cin >> c;
    if(a<=0 || b<=0 || c<=0){
        cout << "All values must be greater than 0!\n";
        system("pause");
        return 1;
    }
    else{
        cout << "Area of the triangle = " << Heron(a,b,c) << endl;
        system("pause");
        return 0;
    }
}
1 5 1