Lab 2 Infix To Postfix, Postfix Expression
Lab 2 Infix To Postfix, Postfix Expression
Roll no:12012100
Infix to postfix
#include<iostream>
#include<stack>
#include<locale> //for function isalnum()
using namespace std;
while(sto.top() != '#') {
postfix += sto.top(); //store and pop until stack is not empty.
sto.pop();
}
return postfix;
}
int main() {
string put;
cout<<"enter the string"<<endl;
cin>>put;
string infix (put);
inToPost(infix);
cout << "Postfix Form Is: " << inToPost(infix) << endl;
}
main() {
string put;
cout<<"enter the string"<<endl;
cin>>put;
string post(put);
postfixEval(post);
cout << "the evaluated postfix is : "<<postfixEval(post);
}
TIME COMPLEXITY :O(N)