Esempio n. 1
0
void main()
{
clrscr();
char infix[40];
puts("\nenter the infix expression :");
gets(infix);
intopost(infix);
getch();
}
Esempio n. 2
0
 int main()
 { char infix[100],postfix[100];
   clrscr();
   printf("\nenter the infix expression");
   gets(infix);
   strcpy(postfix,"");
   intopost(infix,postfix);
   printf("\n the postfix expression");
   puts(postfix);
   getch();
   return 0;
}
Esempio n. 3
0
int main(){
	int result=0;
	int top=-1;
	int x=0;

	printf("Enter the expression to be evaluated");
	scanf("%s",infix);
	
	printf("enter the value of variable");
	scanf("%d",&x);

	intopost(x);
	result=eval(x);
	printf("%d",result);
}
Esempio n. 4
0
int main()
{
STK s;
int cs,ans;
char str[MAX],pre[MAX],post[MAX];

do                                                   /*Using Do-while Loop*/
{
//clrscr();
printf("-----Program for Expressions-----");
printf("Input The String:");
printf("MENU:");
printf("1.Infix to Prefix");
printf("2.Infix to Postfix");
printf("3.Exit");
cs=getche();

switch(cs)  /*Using Switch Case*/
{
case '1':
intopre(str,pre);
break;
case '2':
intopost(str,post);
break;
case '3':
break;
default:
printf("Enter a Valid Choise!"); /*Default Case*/
break;
}
printf("Do you wish to Continue?(y/n)");
ans=getche();
}while(ans=='y'||ans=='Y');   /*Condition for Do-while loop*/

getch();
return 0;
}