guys..
please check this program this is already running but i have no idea to insert a queue
i need all your help guys as soon as possible. I hope that you will grant my request..
thank you...
God Bless and more power..
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream.h>
#include<DOS.H>
#include<process.h>
char stack[30],input[30];
int head=-1;
void push(char z)
{
stack[head]=z;
}
void pop()
{
printf("%c",stack[head]);
}
//void start();
void main()
{
//clrscr();
int a,b,c,d;
clrscr();
for(a=1; a<=75;a++){
gotoxy(2+a,24);textcolor(MAGENTA+BLINK); cprintf("\1");
}
for(b=1; b<=75;b++){
gotoxy(2+b,24);textcolor(GREEN);cprintf("\2");
delay(50);
}
{
gotoxy(5,1);textcolor(GREEN);cprintf(<snipped personal info>);
gotoxy(5,2);textcolor(YELLOW);cprintf("\n\3 DATA STRUCTURE...");
gotoxy(5,3);textcolor(RED);cprintf(<snipped personal info>);
}
//infix/postfix...//
{
gotoxy(10,8);textcolor(YELLOW);cprintf("\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5 \3 \3 \5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5\5");
gotoxy(35,8);textcolor(CYAN+BLINK);cprintf("STACK PROGRAM");
gotoxy(20,12);textcolor(MAGENTA);cprintf("\nEnter Infix:");
}
//printf("Postfix");
scanf("%s",&input);
gotoxy(30,17);textcolor(CYAN+BLINK+BROWN);cprintf("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;
}
}
}
getch();
}