#include <stdio.h>
#include <math.h>
typedef struct{
double x;
double y;
}Point;

Point scan_point(void);
double area_of(Point p1, Point p2);
double circumference_of(Point p1, Point p2);

int main(void) {
    printf("左上隅と右下隅の座標を入力してください。\n");
    Point p1=scan_point();
    printf("座標1(%.2f, %.2f)\n", p1.x, p1.y);
    Point p2=scan_point();
    printf("座標2(%.2f, %.2f)\n", p2.x, p2.y);
    double area=area_of(p1, p2);
    double circumference=circumference_of(p1, p2);

    printf("面積:%.2f\n",area);
    printf("周囲の長さ:%.2f\n",circumference);

    return 0;
}

Point scan_point(void) {
    Point p;
scanf("%lf %lf", &p.x, &p.y);
return p;
}
double area_of(Point p1, Point p2) {
    double width = fabs(p2.x - p1.x);
    double height = fabs(p2.y - p1.y);
    return width * height;
}

double circumference_of(Point p1, Point p2) {
    double width = fabs(p2.x - p1.x);
    double height = fabs(p2.y - p1.y);
    return 2.0 * (width + height);
}

