최솟값과 최댓값(함수)
#2019-08-21 #include int a, b, c, d; int f(int p, int q){ return pq?p:q;} int main() { scanf("%d %d %d %d", &a, &b, &c, &d); printf("%d %d\n", f(f(a,b),f(c,d)), g(g(a,b),g(c,d))); } /* 5 -7 -2 3 -7 5 -------------------------------- Process exited after 5.366 seconds with return value 0 계속하려면 아무 키나 누르십시오 . . . */
2019. 8. 21.
두 점의 중점(함수)
#2019-08-21 #include 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 계속하려면 아무 키..
2019. 8. 21.