Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct point{
- double x;
- double y;
- };
- typedef struct point Point;
- void input(Point * pv1);
- double calcArea(Point v1, Point v2, Point v3);
- int main(){
- Point A, B, C;
- double area;
- input(&A);
- input(&B);
- input(&C);
- area = calcArea(A, B, C);
- printf("Dien tich la %0.2lf\n", area);
- return 0;
- }
- void input(Point * pv1){
- double x,y,i=0;
- printf("Nhap vao toa do diem : ");
- scanf("%lf",&x);
- scanf("%lf",&y);
- pv1->x=x;
- pv1->y=y;
- }
- double calcArea(Point v1, Point v2, Point v3){
- return abs(v1.x*v2.y+v2.x*v3.y+v3.x*v1.y-v1.y*v2.x-v2.y*v3.x-v3.y*v1.x)/2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement