Menu
CoddyTech

복습: 점 이동

Coddy의 PHP 개발자를 위한 C 코스 레슨. 48개 중 26번째.

challenge icon

챌린지

중급

입력은 x,y,dx,dy입니다. translate(Point*,dx,dy)를 구현하여 두 좌표를 제자리에서 모두 변경하세요. 드라이버는 x:y를 출력합니다.

잠금 해제된 소스 파일과 헤더 파일을 수정하세요. 표시된 잠금 파일 main.c에서 함수를 직접 호출하므로, 선언된 공개 API와 호환되게 유지하세요. main을 추가로 작성하지 마세요. 작업에서 특정 범위를 명시적으로 검사하는 경우가 아니라면, 모든 숫자 입력값은 오버플로가 발생하지 않을 만큼 작습니다. 지정된 출력만 출력하세요. 예시가 있는 경우 드라이버가 입력 파싱과 출력을 담당합니다.

직접 해보기

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <stdbool.h>
#include <limits.h>
#include <errno.h>
#include "lesson.h"
int main(void){Point p;int dx,dy;if(scanf("%d%d%d%d",&p.x,&p.y,&dx,&dy)!=4)return 1;translate(&p,dx,dy);printf("%d:%d\n",p.x,p.y);return 0;}

PHP 개발자를 위한 C의 모든 레슨

직접 연습해 보세요: 온라인 C 컴파일러