一、题目要求![](https://i-blog.csdnimg.cn/blog_migrate/91077042b12edf9dde8025c169caacd2.png)
二、代码
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;
//函数
vector<string> split(string str,char ch)
{
vector<string> results;
stringstream ss(str);
string temp;
while(getline(ss,temp,ch))
{
results.push_back(temp);
}
return results;
}
int main()
{
//键盘输入
string str;
getline(cin,str);
//切分
vector<string> results;
results = split(str,' ');
//字符串转浮点数
double num1 = stod(results[0]);
double num2 = stod(results[1]);
double num3 = stod(results[2]);
//计算
double p = (num1+num2+num3)/2;
double temp = p*(p-num1)*(p-num2)*(p-num3);
double s = sqrt(temp);
//打印
cout << fixed << setprecision(1) << s << endl;
return 0;
}