program to find area of triangle

hi, i have written a program to find area of triangle, but i meet some errors, i can not fix this error, kindly help me to fix the error. thanks.

//******area of triangle******//
#include<iostream>
using namespace std;

float trianglearea (float a, float b, float c, float d)
{

float r=a*b*c*d;
float x = r;
float y = 1;
while (y*y<=x)
{
y=y+1;
}
y=y-1;
cout<<y;
float result;
result=y;
return (result);
}


int main()
{

float a, b, c;
cout<<"enter first side of triangle: ";
cin>>a;
cout<<"enter second side of triangle: ";
cin>>b;
cout<<"enter third side of triangle: ";
cin>>c;
float s=(a+b+c)/2;
float d=s-a;
float e=s-b;
float f=s-c;
float area_triangle = trianglearea (s*d*e*f);
cout<<area_triangle;

return 0;

}
Last edited on
while calling the function trianglearea, you are giving just one parameter (s*d*e*f). You have to give four parameters as per your function declaration (s,d,e,f).

Also, please put your code in code tags and state exactly what error you are getting.
Topic archived. No new replies allowed.