[자료구조] post&prefix
본 자료는 2페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
해당 자료는 2페이지 까지만 미리보기를 제공합니다.
2페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

[자료구조] post&prefix에 대한 보고서 자료입니다.

본문내용

rn minus;
case \'/\' : return divide;
case \'*\' : return times;
case \'%\' : return mode;
case \'\\0\' : return eos;
default : return operand;
}
}
char print_token(precedence item){ /* return char value about each precedence type */
switch(item){
case lparen : return \'(\';
case rparen : return \')\';
case plus : return \'+\';
case minus : return \'-\';
case divide : return \'/\';
case times : return \'*\';
case mode : return \'%\';
case eos : return \'\\0\';
default : break;
}
}
precedence print_char(char item){ /* return precedence value about each char type */
switch(item){
case \'+\' : return plus;
case \'-\' : return minus;
case \'/\' : return divide;
case \'*\' : return times;
case \'%\' : return mode;
case \'\\0\' : return eos;
default : return operand;
}
}
void initial_stack(int *ptop){ /* initialize for stack[] reuse(post, pre) */
if(*ptop == -1)
stack[*ptop]=\'\\0\';
stack[(*ptop)--];
}
/* notice each other type */
void push(int *ptop, precedence item){ /* post, prefix 구현을 위한 스택 stack */
if(*ptop >= MAX_STACK_SIZE-1)
stack_full();
stack[++(*ptop)]=item;
}
precedence pop(int *ptop){
if(*ptop == -1)
stack_empty();
return stack[(*ptop)--];
}
void push_1(int *ptop, int item){ /* eval()함수를 위한 스택, 수식의 계산을 위해 stack_1을 사용했다. */
if(*ptop >= MAX_STACK_SIZE-1)
stack_full();
stack_1[++(*ptop)]=item;
}
int pop_1(int *ptop){
if(*ptop == -1)
stack_empty();
return stack_1[(*ptop)--];
}
void stack_full(){
fprintf(stderr,\"\\nstack is full\\n\");
exit(1);
}
void stack_empty(){
fprintf(stderr,\"\\nstack is empty\\n\");
exit(1);
}

키워드

자료구조,   post,   pre,   스택,  
  • 가격1,000
  • 페이지수7페이지
  • 등록일2003.09.28
  • 저작시기2003.09
  • 파일형식한글(hwp)
  • 자료번호#225290
본 자료는 최근 2주간 다운받은 회원이 없습니다.
다운로드 장바구니