중위표기법(Infix)를 전위(Prefix)와 후위(Postfix)로 변환하는 프로그램
- 최초 등록일
- 2011.04.05
- 최종 저작일
- 2011.04
- 6페이지/ 한컴오피스
- 가격 1,000원
소개글
Infix를 Prefix와 Postfix로 변환해주는 프로그램
목차
1. 문제설명
2. 소스코드
본문내용
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX_STACK_SIZE 100 //스택의 최대크기
#define MAX_EXPR_SIZE 100 //수식의 최대크기
typedef enum
{
lparen, rparen, plus, minus, times, divide, mod, eos, operand
} precedence;
precedence stack[MAX_STACK_SIZE];
char print_stack[MAX_STACK_SIZE];
char expr[MAX_EXPR_SIZE];
static int isp[ ] = { 0, 19, 12, 12, 13, 13, 13, 0}; //우선순위 판별
static int icp[ ] = { 20, 19, 12, 12, 13, 13, 13, 0}; //우선순위 판별
int menu();
void add(int *top, precedence item); //stack에 삽입
void push(int *p_top, char item); //print_stack에 삽입
char pop(int *p_top); //print_stack에서 삭제
precedence Delete(int *top); //stack에서 삭제
precedence get_token(char *symbol, int *n); //문자를 토큰으로
char print_token(precedence token); //토큰을 문자로
void prefix(void); //infix를 prefix로 변환
void postfix(void); //infix를 postfix로 변환
.
.
..
참고 자료
없음