Contents

Views 10814 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;
}



?

  1. [jsp] 페이지에 한글이 정상적으로 보이지 않을 때..

  2. [php] 데이터를 엑셀,워드 형태로 변환할 때 헤더(ms-office)

  3. [unix] AIX쉘 초기 파일 (.cshrc)

  4. [jsp] 초간단한 include 구문 예제..

  5. 객체지향 프로그래밍에 대한 개념.. (객체)

  6. [ms-sql] 프로시져 예제..

  7. [c] 문자열 자르는 함수(strtok) 예제

  8. [c++] 퍼즐 버블버블 간단한 원리(사용공식)

  9. [c] 거리와 각도를 입력받아서 좌표로 변환

  10. [doc] 방송통신공학회 논문지(학술대회)

  11. [c++] 윈도우 API 정복 예제

  12. OpenGL 강좌 사이트 모음

Board Pagination Prev 1 ... 30 31 32 33 34 35 36 37 38 39 ... 98 Next
/ 98