c로 만든 공학용계산기 (scientificcalculator.c)
본 자료는 미만의 자료로 미리보기를 제공하지 않습니다.
닫기
  • 1
해당 자료는 0페이지 까지만 미리보기를 제공합니다.
0페이지 이후부터 다운로드 후 확인할 수 있습니다.

목차

20.1KB

본문내용

#include
#include
#include
#include

#define MAX_SIZE 100
#define pi 3.1415926535
#define SIN(INPUT) sin((INPUT/180)*pi)
#define COS(INPUT) cos((INPUT/180)*pi)
#define TAN(INPUT) tan((INPUT/180)*pi)

typedef enum{
    lparen, rparen, plus, minus, times, divide, mod, eos, operand, sine, cosine, tangent, power, factorial
}precedence;
precedence stack[MAX_SIZE];

// isp와 icp 배열
static int isp[] = {0,19,12,12,13,13,13,0,0,14,14,14,15,15};
static int icp[] = {20,19,12,12,13,13,13,0,0,14,14,14,15,15};

char expr[MAX_SIZE];    // 값을 입력
char change_exprs[MAX_SIZE];    // 값을 해결하는 배열로 변환
char post_expr[MAX_SIZE];    // 후위 연산자를 배열에 입력
double cal_stack[MAX_SIZE];
int vir;
float calnum[9];

void ft_oper();    // 사칙연산 함수
double eval(void);    // 후위 표기식 계산 함수
precedence getToken(char *symbol, int *n, int flag);    // 입력 스트링으로부터 토큰을 가져오는 함수
char printToken(precedence token);
void postfix(void);    // 중위 표기를 후위 표기로 변환하는 함수
void change_expr(void);
void push(int *top, precedence token);    // 스택 삽입
precedence pop(int *top);    // 스택 삭제
void cal_push(int *post_top, double result);    // 스택 삽입
double cal_pop(int *post_top);    // 스택 삭제
double fact(int num);    // 팩토리얼
int is_num(char chr);
int is_char(char chr);    // 삼각함수 인식
void ft_calculus();    // 미분적분 함수
void calinput();    // 미적분식 입력
void caloutput();    // 입력한 미적분식 출력
void ft_change();    // 진법변환 함수
void binary(int num);    // 이진법 변환
void ft_anykey();    // 대기함수
void ft_exit();    // 종료함수

void main(void)
{
    char choice;
    int loop=1;

    while(loop)
    {
        system("cls");    // 화면 지우기
        printf("┏━━━━━━━━━━━━━━━━━━┓\n");
        printf("┃ ┃\n");
        printf("┃ 업그레이드 계산기 ┃\n");
        printf("┃ ┃\n");
        printf("┃ 1. 사칙연산 ┃\n");
        printf("┃ 2. 미분적분 ┃\n");
        printf("┃ 3. 진법변환 ┃\n");
        printf("┃ 4. 종료 ┃\n");
        printf("┃ ┃\n");
        printf("┃ ┃\n");
        printf("┗━━━━━━━━━━━━━━━━━━┛\n\n");
        printf("번호 선택 : [ ]\b\b\b");
        fflush(stdin);    // 버퍼 지우기
        scanf("%c", &choice);

        switch(choice)
        {
  • 가격2,300
  • 페이지수1페이지
  • 등록일2012.07.08
  • 저작시기2011.6
  • 파일형식기타(c)
  • 자료번호#757405
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니