Question: Set animals _ considered is initialized with four animals read from input. Assign num _ animals with the number of elements in animals _ considered.
Set animalsconsidered is initialized with four animals read from input. Assign numanimals with the number of elements in animalsconsidered. Then, clear animalsconsidered.
Click here for example
Note: Because sets are unordered, the set is printed using the sorted function here for comparison.
animalsconsidered set
newanimal input
newanimal input
newanimal input
newanimal input
animalsconsidered.addnewanimal
animalsconsidered.addnewanimal
animalsconsidered.addnewanimal
animalsconsidered.addnewanimal
Your code goes here
printfNumber of values considered: numanimals
printsortedanimalsconsidered
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
