Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; /* Implement tree */ /* Implement Evaluation Function for the epression tree NOTE: you can implement any helper function that you

#include using namespace std; /* Implement tree */

/* 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions

Question

Are we being responsive to current business priorities?

Answered: 1 week ago