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



?

  1. [linux] SSH에 대한 기본 설명과 설치/설정

  2. [perl] 영규가 만든 스크립트.. 하하..

  3. [c++]현승이가 보내준 암호화 모듈 AES라인델..

  4. [js] jQuery plugin 요약

  5. [c++] p.118 확인학습 5번

  6. [c++] 가짜 인증서(하나은행) 프로그램

  7. [php] XE 관리자 IP대역 설정 오류 해결법

  8. [linux] 프로세스의 stat 상태에 대한 설명

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

  10. OSI (Open Systems Interconnection) 개방형 시스템간 상호 접속

  11. [js] 순환참조에 의한 메모리 누수 관련

  12. [unix] 로그파일 정리 쉘스크립트

Board Pagination Prev 1 ... 55 56 57 58 59 60 61 62 63 64 ... 98 Next
/ 98