📄 lab1.cpp
字号:
#include <cmath>
#include <iostream>
using namespace std;
#include "Point.h"
double computeArea(Point &a, Point &b, Point &c);
int main()
{
double x, y, z;
cout<< "insert the a: ";
cin >>x>>y>>z;
Point a( x, y , z );
cout<< "insert the b: ";
cin >>x>>y>>z;
Point b( x, y , z );
cout<<"insert the c: ";
cin >>x>>y>>z;
Point c( x, y , z );
cout<<"The area of triangle is: "
<<computeArea( a, b, c );
return 0;
}
double computeArea(Point &a, Point &b, Point &c)
{
double d1=a.distanceTo ( b );
double d2=b.distanceTo ( c );
double d3=c.distanceTo ( a );
double p=( d1 + d2 + d2 ) / 2;
return sqrt(p * ( p - d1 ) * ( p - d2 ) * ( p - d3 ) );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -