Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE C++ Write a program that will ask the user for a string of no more than 9 characters in length o This string

PLEASE USE C++

Write a program that will ask the user for a string of no more than 9 characters in length o This string should only contain the characters A,B,C,D

You need to write a function that will try to guess the inputted string by trying all possible combination of A,B,C,D until it guesses the correct string

Your program should print out every string the program has tried followed by ---incorrect or ---correct

YOU ARE NOT ALLOWED TO USE ANY LOOPS IN YOUR PROGRAM

You must write at least three functions

int main() o Which is the main function. Keep it brief

A recursion function that checks that the string only contains A,B,C and Ds in it

A recursion function for guessing the inputted string. This function must be recursive and cannot create new strings, vectors or any other object.

If you pass in an object ( string, vector, ect) to this function you must pass it by reference. Note: string.resize() is very useful for this assignment. In a string char 0 will not be printed with a std::cout.

SAMPLE OUT

Enter in a string (between 0 and 9 characters):

AAAAAABDC ----incorrect

A----incorrect

AAAAAABDC----correct

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

More Books

Students also viewed these Databases questions

Question

Comprehend the concept of the "psychological contract."

Answered: 1 week ago

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago