利用海伦公式求三角形面积,因此先利用两点距离公式求得边长,即可求出面积
一、实现代码
#include <iostream>
#include <cmath>
using namespace std;
int transform(char* str, int* coord); //提取数字函数
double length(int* a, int* b); //计算边长函数
int main()
{
char str[10]; //输入的字符串
int coord1[2], coord2[2], coord3[2]; //储存三个坐标值
int judge;
for (int i = 0; i < 3; i++)
{
cout << "坐标" << i << ":";
gets_s(str);
switch (i + 1)