Write an object oriented C++ program to translate a C++ assignment statement int
ID: 3570796 • Letter: W
Question
Write an object oriented C++ program to translate a C++ assignment statement into triplet form. You may assume that variables are single characters. Use a precedence table to decide if operators get pushed or popped. Be sure to give clear directions so that a person unfamiliar with this process will understand how to execute your solution.Explanation / Answer
#include #include #include using namespace std; class tripletform { public: void process(const string& x); void precedence(const string& x); private: stack letters; stack operators; }; void tripletform::precedence(const string& x) { } void tripletform::process(const string& x) { //int count = x.length(); for(int i = x.length(); i > -1; i--) { if (i = 'z'){ letters.push(x[i]); } } for(int j = x.length(); j > -1; j--) { if(j == '('){ operators.push(x[j]); } if (j == '='){ operators.push(x[j]); } if(j == '*' || j == '/') { operators.push(x[j]); } if (j == '+' || j == '-' ) { operators.push(x[j]); } if(j == ')'){ operators.push(x[j]); } } while(!letters.empty()){ coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.