-1

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;
	 }
}
}
Comments
For not listening to previous advice on how to post, and posting two badly presented threads on the same problem.
3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Nick Evan
Featured Replies
  • 1

    [QUOTE=mhil_joy;683642]if cannot work please help me..[/QUOTE] That's a syntax error , it should be: [code=cplusplus] if (!work) { HelpMe("please"); }[/code] Now what is your question? Also learn to use c[URL="http://www.daniweb.com/forums/misc-explaincode.html"]ode-tags[/URL]!! Read More

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.