#include <iostream> #include<stdio.h> #include<math.h> using namespace std; int main() { double a, b, c; while (scanf_s("%lf %lf %lf", &a, &b, &c) != EOF) { double p = (a + b + c) / 2.0; printf("%.2f\n", sqrt(p*(p - a)*(p - b)*(p - c))); } return 0; } /* Main.cc: In function 'int main()': Main.cc:7:9: error: 'scanf_s' was not declared in this scope while (scanf_s("%lf %lf %lf", &a, &b, &c) != EOF) { ^~~~~~~ Main.cc:7:9: note: suggested alternative: 'scanf' while (scanf_s("%lf %lf %lf", &a, &b, &c) != EOF) { ^~~~~~~ scanf */ |
Double click to view unformatted code.