본문 바로가기
정보과학

두 점의 중점(함수)

by chaechaekim 2019. 8. 21.
#2019-08-21
#include<stdio.h>
struct point { float x; float y;};
point f(point p, point q)
{
	point t;
	t.x=(p.x+q.x)/2;
	t.y=(p.y+q.y)/2;
	
	return t;
}

int main()
{
	point a, b, t;
	scanf("%f %f", &a.x, &a.y);
	scanf("%f %f", &b.x, &b.y);
	
	t=f(a, b);
	
	printf("%.3f %.3f\n", t.x, t.y);
}

/*

3.1 1.4
4.1 1.5
3.600 1.450

--------------------------------
Process exited after 15.35 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .

*/

'정보과학' 카테고리의 다른 글

사칙연산계산기  (0) 2019.08.23
최솟값과 최댓값(함수)  (0) 2019.08.21
별 찍기  (0) 2019.08.14
택시 거리 계산하기  (0) 2019.06.19
별삼각형  (0) 2019.06.12

댓글