Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C + + program to identify something by applying series of yes - no questions. To start, tell the user you are ready

Write a C++ program to identify something by applying series of yes-no questions.
To start, tell the user you are ready to help them identify whatever it is that they are observing -- such as a car problem, and a song, an animal, a bird, a chemical compound, etc -- you choose. It's similar to the movie guessing game discussed in class example. Then in a series of at 3 questions, identify or diagnose.
The program simply has to reach the end of its tree and present its diagnosis or answer to the user. It does not have to learn anything.
Innate Knowledge
"Innate" means that the program is "born" with certain knowledge. There's nothing for it to learn, because the programmer (you) already put knowledge (in the form of questions and answers) in its coding. You need to build the binary tree similar of the movie example.
Requirements
Allow user responses of Y, y, N, and n -- do not require the user to type the full words "yes" or "no".
Include at least 15 total nodes in your tree, with 7 questions: a top node, its two descendants, and their 4 descendants. The 8 descendants of the last 4 questions are to be answers.
Use dynamically allocate nodes to create nodes and add to the tree.
After the p pointer reaches an answer, present your diagnosis or identification and exit the p-loop and let the program end.
At the end, write (serialize down) contents of the entire tree into a file call "ai.txt". You have to use a recursive function to perform serialize down. You can either use the example function in class or write your own.
At the end, deallocate all the nodes.
You are not allowed to re-use movies as your problem domain.
Submissions:
1. Your CPP
2. The output file ai.txt
3. The drawing of your binary tree (you can use MS Word or PowerPoint to draw)

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions