Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am working on a assignment on C++ that deals with Boolean function, and I am having trouble figuring it out. The question is..

I am working on a assignment on C++ that deals with Boolean function, and I am having trouble figuring it out. The question is..

"The menu asks the user to enter an option. The user should be able to enter any string for the option. The first character of the string entered is upper-cased and used as the option. Examples: Enter an option: o converted to O and accepted Enter an option: only first character o is capitalized to O and accepted When an invalid option is entered, the program prints Invalid option, enter I, O, L or X! and repeats the input until a valid option Is entered. If it finds the given character, it returns true. If it does not find the character, it returns false. This can be used instead of a long list of conditional expressions. Ex: so we do NOT have to write: if (c !=X && c!=O && c!=L && for ever & ever && c !=Z) instead of if (!isValidOption(c,XOLZ))"

Basically it asks user to type in character X, O , L, or I. But if the user type in lowercase of those letters it will also accept the input and if they type a word (string) that starts with one of those letters it will also accept the input.

image text in transcribed

I know I have to use a Boolean function but I am not sure how to start

bool isValidOption() {

return true

}

I - List our Inventory 0-Make an Order L - List al1 Orders made X - Exit Enter an option: what option? Inualid option enter I 0. L or X! Enter an option: try again? Invalid option. enter I. 0. L or ! Enter an option: ok this will worlk

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions