Code:
void duom(double &a, double &b, double &c)
{
ifstream in("sk.txt");
in >> a;
in >> b;
in >> c;
in.close();
}
double S(double a, double b, double c)
{
double p;
double S;
if ((a+b>c) && (a+c>b) && (b+c>a))
{
p = (a+b+c)/2;
S = sqrt(p*(p-a)*(p-b)*(p-c));
}
return S;
}
int main()
{
double a;
double b;
double c;
double s;
duom(a , b , c);
s=(a, b , c);
if(s>0)
{
cout << "area of a triangle is " << s;
}
else
{
cout << "triangle does not exist" << endl;
}
return 0;
for some reason the double function does not work that is the program just skips the whole thing.