Question
#include using namespace std; /* Implement tree */ /* Implement Evaluation Function for the epression tree NOTE: you can implement any helper function that you
#include
/* Implement Evaluation Function for the epression tree NOTE: you can implement any helper function that you require. */ int Evaluation(node* root) //this header can be changed according to your logic { }
/* Driver Function */ int main() {
char ans; //for geting answer from user int play; //for end result /* if rain=yes, snow=yes , work=finished then play->no if rain=yes, snow=no , work=finished then play->no if rain=no, snow=yes , work=finished then play->no if rain=no, snow=no , work=finished then play->yes if rain=no, snow=no , work=not fininshed then play->no Remember 1 means true and 0 means false, So to get correct 'play' result fill the following parts of code accordingly. HINT: Following is what your tree would look like for this particular task so build tree according to it. X ---root / \ X P / \ P P where P represents boolean value 0 or 1, and X represents AND or OR operators. */ cout<<"Is it raining?(y/n) "; cin>>ans; if(ans=='y' || ans=='Y') /* fill this out */ else if (ans=='n'|| ans=='N') /* fill this out */ cout<<"Is it Snowing?(y/n) "; cin>>ans; if(ans=='y' || ans=='Y') /* fill this out */ else if (ans=='n'|| ans=='N') /* fill this out */ cout<<"Have you finished your work?(y/n) "; cin>>ans; if(ans=='y' || ans=='Y') /* fill this out */ else if (ans=='n'|| ans=='N') /* fill this out */ //construct binary expression tree according to the answers of the user //evaluate the constructed tree for result. //Result will be either 1 or 0 //play = Evaluation(root of the tree);// this function call parameter can change according to your logic
if(play==1) cout<<" You can play outside."; else if(play==0) cout<<" You can\'t go outside to play.";
return 0; }
Please solve according to given comments instruction C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started