Sorry it was developed for numbers only
here is final code
Code:/*\ Write a C++ program to convert any infix expression to its post-fix form.... Eg- if user enters a+b it should print ab+ \*/ #include <iostream> #include <iomanip> using std::cin; using std::endl; using std::cout; using std::setw; int main() { int hold=0; const int max=100; char string[max] = {0}; char repeat('n'); char stringExp[max] = {0}; char stringSymbol[max] = {0}; int j=0; int i=0; int k=0; cout << "Type any Expression to proceed" << endl; cin.getline(string,max,'\n'); cout << endl; while(string[i] != '\0') //till it reach the null character { if(('9' >= string[i] && '0' <= string[i]) || ('a'<= string[i] && 'z' >= string[i]) || ('A'<= string[i] && 'Z' >= string[i]) ) { stringExp[k] = string[i]; k++; }else { stringSymbol[j] = string[i]; j++; } i++; } cout << endl; cout << "Final Out Put " << stringExp << stringSymbol ; cout << endl; cin >> hold; return 0; }
View attachment 16329
That's better

Nice way to check chars, and why u checking numbers?
NICE WORK........
There's a priority of operators when pushing back..
Now.........
Try with expression more than one operator
eg-
a-b/c
output
abc/- (remember B O D M A S)
Last edited:
