#include"stdio.h"
#include"string.h"
#include"math.h"
#include"stdlib.h"
void convlute(char s1[20],char s2[20])
{
	int i,p=0,t=0;
	char s3[20];
	for(i=0;i<20;i++)
	{
		if(s1[i]!='+'&&s1[i]!='-'&&s1[i]!='*'&&s1[i]!='/'&&s1[i]!='('&&s1[i]!=')')
		{
			s2[p]=s1[i];
			p++;
		}
		else if(s1[i]='(')
		{
			t++;
		}
				else if(s1[i]=='+'||s1[i]=='-')
		{
			if(s3[t]=='*'||s3[t]=='/')
			{
				s2[p]=s3[t];
				s3[t]=s1[i];
				t++;
				p++;
			}
			else 
			{
				s3[t]=s1[i];
				t++;
			}
		}
		else if(s1[i]=='*'||s1[i]=='/')
		{
			s2[p]=s1[i];
			p++;
		}
		else if(s1[i]==')')
		{
			do
			{
			s2[p++]=s3[t--];
			}
			while(s3[t]!='(');
		}
	}
}
void main()
{
	char x[20],y[20];
	int i;
	for(i=0;i<20;i++)
		scanf("%c",&x[i]);
	for(i=0;i<20;i++)
		y[i]=0;
	convlute(x[20],y[20]);
	printf("%s",y);
}

Edited 6 Years Ago by Nick Evan: Added code-tags

it's a programm that include operatins of : ( ) + - * / and user makes what he want like :(3+8)/(5*6-2)

ok when i try it the programm must take the 20 of the array ok
then it must give us the results..it didnot it stoped at
if(s1!='+'&&s1!='-'&&s1!='*'&&s1!='/'&&s1!='('&&s1!=')')
i want to know why
plz try it and tell me if my info doesn't satisfy u

You are passing both the array by value (syntax for this is also wrong). Change this to pass by pointer

There are more serious bugs ... Will try to get back to you in some time on those

Edited 6 Years Ago by abhimanipal: n/a

This article has been dead for over six months. Start a new discussion instead.