View Code of Problem 24

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;
int main()
{
	double x, y, z;
	while (cin >> x >> y >> z) {
		double p = (x + y + z) / 2.0;
		double s = sqrt(p*(p - x)*(p - y)*(p - z));
		cout << fixed << setprecision(2) << s<<endl;
	}

}
/*
Main.cc: In function 'int main()':
Main.cc:13:14: error: 'sqrt' was not declared in this scope
   double s = sqrt(p*(p - x)*(p - y)*(p - z));
              ^~~~
Main.cc:13:14: note: suggested alternative: 'qsort'
   double s = sqrt(p*(p - x)*(p - y)*(p - z));
              ^~~~
              qsort
*/

Double click to view unformatted code.


Back to problem 24