prefix to postfix and infix

I need to write a program that reads a file as input and converts prefix to postfix and infix.. I wanted to know if I should do this using trees or think of an algorithm to convert it ..
I've figured out the basic code for converting a prefix expression to infix expression but can't figure out how to place the brackets. Here's my code:

int main(int argc, char* argv[])
{
char input;
char symb;
Stack S;
char String[50] = "/0";
int i=0;


//cout<<endl<<"Prefix Expression : ";

fstream File("Prefix.txt", ios::in);
cout<<endl;
cout<<"Infix Expression : ";
while(File>>input)
{
symb = input;
if(symb >= 65 && symb <= 90)
{
String[i] = symb;
cout<<String[i];
if(S.IsEmpty() != true)
{
S.Pop();
}
i++;
}
else
{

S.Push(symb);
}
}




cout<<endl;

return 0;
}
Help with the brackets please !!!
Topic archived. No new replies allowed.