극 좌표계의 좌표인 거리와 각도를 입력 받아서
직각 좌표계의 좌표 x, y 로 변환하는 프로그램
/* * 극 좌표계의 좌표인 거리와 각도를 입력 받아서 * 직각 좌표계의 좌표 x, y 로 변환하는 프로그램 */ #include <stdlib.h> #include <stdio.h> #include <math.h> #define PI 3.14159 #define X 0 #define Y 1 float* get_coord_ad( float degree, float distance ){ float* point = malloc( sizeof( float ) * 2 ); degree = PI * degree / 180; point[X] = distance * cos( degree ); point[Y] = distance * sin( degree ); return point; } int main(){ float dist, ang, *ptr_coord; printf( "Enter a distance : " ); scanf( "%f", &dist ); fflush( stdin ); printf( "Enter a degree : " ); scanf( "%f", &ang ); fflush( stdin ); ptr_coord = get_coord_ad( ang, dist ); printf( "\n극 좌표(%-4.2f, %-4.2f)를 직각 좌표로 변환하면 (%-4.2f, %-4.2f)입니다.\n", dist, ang, ptr_coord[X], ptr_coord[Y] ); free( ptr_coord ); return 1; }
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
277 | Develop | [android] 해상도 관련 팁 (dip -> pixel 변환) | hooni | 2013.04.23 | 16465 |
276 | Etc | 여러 대학 및 권위있는 기관 강좌 모음 ㅋㅋ | hooni | 2013.06.17 | 16488 |
275 | Develop | [ios] UI컨트롤러 샘플코드 | hooni | 2013.08.08 | 16489 |
274 | Develop |
[c] 윈도우 API sin 함수 출력..
![]() |
hooni | 2013.04.23 | 16532 |
273 | Develop | [erp] SAP 모듈 요약 | hooni | 2013.04.23 | 16600 |
272 | System/OS |
[owasp] 10대 웹어플리케이션 보안 취약
![]() |
hooni | 2013.04.23 | 16714 |
271 | System/OS |
라우팅 경로 결정 영향 요소 ㅋㅋ
![]() |
hooni | 2013.04.23 | 16736 |
270 | PPT |
[ppt] 웜 과제 진행사항(프레임워크 검증환경 구축) 보고
![]() |
hooni | 2013.04.23 | 16800 |
269 | Algorithm | [algorithm] Greedy (탐욕 기법) | hooni | 2003.04.23 | 16822 |
268 | System/OS | [linux] 종료와 종료코드 확인(환경변수에서) | hooni | 2003.04.23 | 16903 |
267 | Etc |
여기저기서 모은 VoIP(인터넷전화) 자료들~
![]() |
hooni | 2013.04.23 | 16955 |
266 | Develop | OGNL(Object Graph Navigation Language) | hooni | 2013.04.23 | 16956 |