Question: For this project, you will use the bag class from Section 5.6, including the grab method that returns a randomly selected element. Use this ADT
For this project, you will use the bag class from Section 5.6, including the grab method that returns a randomly selected element. Use this ADT in a program that does the following:
1. Asks the user for a list of 10 nouns.
2. Asks the user for a list of 10 verbs.
3. Prints some random sentences using the provided nouns and verbs.
For example, if two of the nouns were “monkey” and “piano” and two of the verbs were “eats” and “plays,” we can expect any of these sentences:
The monkey eats the piano.
The monkey plays the piano.
The piano eats the monkey.
The piano plays the monkey.
Needless to say, the sentences are not entirely sensible. Your program will need to declare two bags: one to store the nouns and one to store the verbs. Use an appropriate top-down design.
Step by Step Solution
3.31 Rating (178 Votes )
There are 3 Steps involved in it
include include include Bagh using namespace std Function prototypes void getUserInputBag nouns Bag ... View full answer
Get step-by-step solutions from verified subject matter experts
