guys i need your help now, tomorrow will be our submitting our program but i have some problem about my program which is the infix to postfix then getting the answer..
I have already the infix to postfix then i don't know how to get the answer, this program is already running...but i need all your knowledge to continue or to give some idea from this program.. I need this as soon as possible..
thank you...
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
char stack[30], input[30];
int head=-1;
void push(char z)
{
stack[head]=z;
}
void pop()
{
printf("%c",stack[head]);
}
void infix_postfix()
{
int a,b;
clrscr();
for(a=1; a<=75;a++){
gotoxy(2+a,23);textcolor(MAGENTA); cprintf("\1");
}
for(b=1; b<=75;b++){
gotoxy(2+b,23);textcolor(WHITE);cprintf("\2");
delay(90);
} clrscr();
//infix/postfix...//
gotoxy(13,4);textcolor(YELLOW);cprintf(" \3 POSTFIX/INFIX \3 ");
gotoxy(20,10);textcolor(MAGENTA);cprintf("\nEnter Infix:");
//printf("Postfix");
scanf("%s",&input);
gotoxy(27,13);textcolor(CYAN+BLINK+BROWN);printf("Postfix:");
for(int x=0;x<=30;x++)
{
switch(input[x])
{
case '1':
{
printf("1");
break;
}
case '2':
{
printf("2");
break;
}
case '3':
{
printf("3");
break;
}
case '4':
{
printf("4");
break;
}
case '5':
{
printf("5");
break;
}
case '6':
{
printf("6");
break;
}
case '7':
{
printf("7");
break;
}
case '8':
{
printf("8");
break;
}
case '9':
{
printf("9");
break;
}
case '+':
{
head++;
push(input[x]);
break;
}
case '-':
{
head++;
push(input[x]);
break;
}
case '/':
{
head++;
push(input[x]);
break;
}
case '*':
{
head++;
push(input[x]);
break;
}
case ')':
{ pop();
break;
}
case '(':
{
//---------ignore---------//
break;
}
}
}