View Code of Problem 24

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <iomanip>
#include<vector>
using namespace std;
int main()
{
	int a, b, c;
	while (cin >> a >> b >> c) {
		double p = (a + b + c) / 2.0;
			double s =sqrt( (p*(p - a)*(p - b)*(p - c)));
			cout << fixed << setprecision(2) << s<<endl;
	}
}
/*
Main.cc: In function 'int main()':
Main.cc:14:14: error: 'sqrt' was not declared in this scope
    double s =sqrt( (p*(p - a)*(p - b)*(p - c)));
              ^~~~
Main.cc:14:14: note: suggested alternative: 'qsort'
    double s =sqrt( (p*(p - a)*(p - b)*(p - c)));
              ^~~~
              qsort
*/

Double click to view unformatted code.


Back to problem 24