Contents

Views 10849 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
극 좌표계의 좌표인 거리와 각도를 입력 받아서
직각 좌표계의 좌표 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;
}



?

List of Articles
No. Category Subject Author Date Views
465 Develop [ios] AES256 알고리즘을 이용해 데이터 암호화/복호화 방법 file hooni 2015.07.21 4198
464 Develop [ios] @property의 속성 (strong, weak, copy) 사용 경우 hooni 2014.08.08 1782
463 Develop [ios] UIView 계층구조 hooni 2015.01.03 1231
462 Etc [htm] DOM에 대해 ㅎㅎ file hooni 2003.04.23 14768
461 Develop [html] 캐쉬된 웹페이지 사용하지 않도록 하는 방법 hooni 2003.04.23 13073
460 Develop [html] 메타태그 사용예.. 은지나 바라~ hooni 2003.04.23 7260
459 Develop [html] SVG(Scalable Vector Graphics) 간단 정리 hooni 2014.02.13 8873
458 Develop [html] HTML5 튜토리얼 링크 ㅋㅋ hooni 2013.04.23 12830
457 Develop [git] 쉬운 버전관리 Git 설명 hooni 2015.08.18 970
456 Etc [flash] 페이지 이동 (액션스크립트) file hooni 2013.04.23 16296
455 Etc [flash] 자동차 엔진의 원리 (4행정 사이클 그림) file hooni 2013.04.23 21290
454 Etc [flash] 맘에 드는 파이차트 file hooni 2013.04.23 12633
Board Pagination Prev 1 ... 55 56 57 58 59 60 61 62 63 64 ... 98 Next
/ 98