#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);
}

Recommended Answers

All 8 Replies

"It doesn't work" isn't going to cut it. Give us some specifics.

Also, use code tags

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

The info helps, but that's not what I mean by specifics... What are the errors?

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

i know there r bugs but where it is

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.