Views 11454 Votes 0 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. [c++] 문자열 뒤집기(문자열 거꾸로 출력)

  2. [c] ICMP 패킷을 이용한 장난감

  3. [java] 입출력 스트림 1부 (문자)

  4. [c] 팩토리얼 서버/클라이언트..

  5. [linux] 최소한의 커널 설정(커널설치 전체과정)

  6. [switch] 시스코 카탈리스트(Cisco Catalyst) 기본 설정

  7. [ios] 자주 쓰는 패턴과 API

  8. [php] 프레임워크 발표자료 및 샘플 구현 소스

  9. [security] 블럭 암호에 대해서..

  10. [windows] 패스워드를 잊어먹었을때..

  11. 네트워크별 MTU(최대 전송 단위)

  12. 암호 알고리즘 및 프로토콜의 이해..

  13. 무선 인증 서버.. 김도.. ㅋㅋ

  14. [linux] 커널 컴파일, 설정

  15. GSM에서 음성이 실리는 과정 요약..

  16. [windows] 도스 사용 팁

Board Pagination Prev 1 ... 58 59 60 61 62 ... 74 Next
/ 74