[C언어]C언어 계산기 프로그램 입니다
- 최초 등록일
- 2006.05.30
- 최종 저작일
- 2006.05
- 압축파일
- 가격 1,500원
소개글
스택을 이요한 C언어 계산기 프로그램
void init_stack(void) /* Initialize stack */
int push(int t) /* Push function */
int pop(void) /* Pop function */
int get_stack_top(void) /* Getting the stack`s top value */
int is_stack_empty(void) /* Checking the stack is empty or not */
int is_operator(int op) /* Is this an operator ? */
int precedence(int op) /* Check the precedence between operators */
int is_legal(char *postfix)
void postfix(char *dst, char *src)
int eval(char *post)
int main()
컴파일 실행환경
quince. turbo-c, visual c++등등
본문내용
int main()
{
int result;
char exp[256], infix[256];
while(1) /* infinite loop */
{
printf("\n\nInput infix expression\n");
printf("(To quit this program, press Ctrl+c) : \n");
printf("==> ");
if(scanf("%s", &infix)==EOF) /* If press ^c, scanf returns EOF. We can make it exit algorithm */
{
printf("\n");
exit(0);
}
postfix(exp, infix); /* Call postfix function */
printf("\nPostfix : %s", exp);
if (!is_legal(exp)) /* Check the postfix expression */
{
printf("\n Expression is not legal!\n\n");
continue;
}
result = eval(exp); /* Calculate postfix expression */
printf("\nAnswer : %d\n\n", result);
}
return 0;
}
압축파일 내 파일목록
clac.c
clac.dsp
clac.ncb
clac.plg
clac.dsw
clac.opt
Debug/clac.exe
Debug/clac.ilk
Debug/clac.obj
Debug/clac.pch
Debug/clac.pdb
Debug/vc60.idb
Debug/vc60.pdb
참고 자료
없음