목차
1. Source Code ( hw8.c ) -3 -
2. 실행 화명
Error 검사(1) - 14 -
Error 검사(2) - 15 -
3. hw8.out ( 실행 결과 ) - 16 -
2. 실행 화명
Error 검사(1) - 14 -
Error 검사(2) - 15 -
3. hw8.out ( 실행 결과 ) - 16 -
본문내용
tf(fp,"%d",top->data - MAX_ASCII);
}
else if ( top->data > 47 ){// 숫자가 아닌 operand인 경우.
printf("%c",top->data);
fprintf(fp,"%c",top->data);
}
else print_token( top->data );// 나머지 경우.
top = top->link;
}
}
stack_ptr invert ( stack_ptr lead ){ // invert stack
stack_ptr middle, trail;
middle = NULL;
while ( lead ){
trail = middle;
middle = lead;
lead = lead->link;
middle->link = trail;
}
return middle;
}
int Stack_Size(stack_ptr strp){ // get stack size
int size=0;
stack_ptr temp = strp;
for ( ; strp ; strp = strp->link ){
size++;
}
strp = temp;
return size;
}
♣ 실행 화면
1. Error 검사(1)
2. Error 검사(2)
♣ hw8.out
--------------------------------------------------------
Welcome to Change Infix to Prefix and Postfix Program.
--------------------------------------------------------
Input infix numerical formula
: ((((a/b)-c+(d*e))-(a*c))
Get Input Ok...
Lparen more than Rparen, miss match parens..
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((((10/2)-1)+(32*2))-(13*11))
Get Input Ok...
Postfix : 102/1-322*+1311*-
Prefix : -+-/1021*322*1311
evaluation of input : -75
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: a+b*d-w/t%s
Get Input Ok...
Postfix : abd*+wt/s%-
Prefix : -+a*bd%/wts
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (a+b)*e-x/g
Get Input Ok...
Postfix : ab+e*xg/-
Prefix : -*+abe/xg
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((a+b)-d)+d*e
Get Input Ok...
Postfix : ab+d-de*+
Prefix : +-+abd*de
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((a+d)*w-(c-w))+((d+e)*w-(d-s))
Get Input Ok...
Postfix : ad+w*cw--de+w*ds--+
Prefix : +-*+adw-cw-*+dew-ds
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: 1+2*3+7%2
Get Input Ok...
Postfix : 123*+72%+
Prefix : ++1*23%72
evaluation of input : 8
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((10+3)*2)-5*4
Get Input Ok...
Postfix : 103+2*54*-
Prefix : -*+1032*54
evaluation of input : 6
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (13+4)*3+((43+32)*12)
Get Input Ok...
Postfix : 134+3*4332+12*+
Prefix : +*+1343*+433212
evaluation of input : 951
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (10*320)%12+(122/2)*2
Get Input Ok...
Postfix : 10320*12%1222/2*+
Prefix : +%*1032012*/12222
evaluation of input : 130
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Goodbye and thanks for using this software
}
else if ( top->data > 47 ){// 숫자가 아닌 operand인 경우.
printf("%c",top->data);
fprintf(fp,"%c",top->data);
}
else print_token( top->data );// 나머지 경우.
top = top->link;
}
}
stack_ptr invert ( stack_ptr lead ){ // invert stack
stack_ptr middle, trail;
middle = NULL;
while ( lead ){
trail = middle;
middle = lead;
lead = lead->link;
middle->link = trail;
}
return middle;
}
int Stack_Size(stack_ptr strp){ // get stack size
int size=0;
stack_ptr temp = strp;
for ( ; strp ; strp = strp->link ){
size++;
}
strp = temp;
return size;
}
♣ 실행 화면
1. Error 검사(1)
2. Error 검사(2)
♣ hw8.out
--------------------------------------------------------
Welcome to Change Infix to Prefix and Postfix Program.
--------------------------------------------------------
Input infix numerical formula
: ((((a/b)-c+(d*e))-(a*c))
Get Input Ok...
Lparen more than Rparen, miss match parens..
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((((10/2)-1)+(32*2))-(13*11))
Get Input Ok...
Postfix : 102/1-322*+1311*-
Prefix : -+-/1021*322*1311
evaluation of input : -75
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: a+b*d-w/t%s
Get Input Ok...
Postfix : abd*+wt/s%-
Prefix : -+a*bd%/wts
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (a+b)*e-x/g
Get Input Ok...
Postfix : ab+e*xg/-
Prefix : -*+abe/xg
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((a+b)-d)+d*e
Get Input Ok...
Postfix : ab+d-de*+
Prefix : +-+abd*de
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((a+d)*w-(c-w))+((d+e)*w-(d-s))
Get Input Ok...
Postfix : ad+w*cw--de+w*ds--+
Prefix : +-*+adw-cw-*+dew-ds
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: 1+2*3+7%2
Get Input Ok...
Postfix : 123*+72%+
Prefix : ++1*23%72
evaluation of input : 8
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: ((10+3)*2)-5*4
Get Input Ok...
Postfix : 103+2*54*-
Prefix : -*+1032*54
evaluation of input : 6
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (13+4)*3+((43+32)*12)
Get Input Ok...
Postfix : 134+3*4332+12*+
Prefix : +*+1343*+433212
evaluation of input : 951
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Input infix numerical formula
: (10*320)%12+(122/2)*2
Get Input Ok...
Postfix : 10320*12%1222/2*+
Prefix : +%*1032012*/12222
evaluation of input : 130
Press 'q' key to quit.
Press 'h' key to see Input Grammer
Press any other key to contiue.
Goodbye and thanks for using this software
키워드
추천자료
- [자료구조] max heap
- [자료구조] BFS&DFS&BST
- [자료구조] post&prefix
- 자바 자료구조 족보
- 힙 자료구조를 이용한 상입,제거(특정 토큰에 대해)
- 리스트 자료구조를 이용한 상입,제거(특정 토큰에 대해)
- [자료구조] 배열을 이용한 다항식의 덧셈 곱셈 연산
- [자료구조, Algorithm] 외부정렬(External Sort) PPT version
- [자료구조]다익스트라 최단 경로 알고리즘
- [자료구조] 원형 덱
- [자료구조] 그래프
- SK텔레콤 자본구조발표자료
- C언어 자료구조 Binary Search Tree (이진 탐색 트리)
- [자료구조] Linked List를 이용한 예약프로그램 - 버스예약 프로그램을 Linked_list로 구현한다
소개글