Question: Write a program in a file named SeedFinder. cpp that finds and displays all the seeds of an integer given by the user. Let's define

Write a program in a file named SeedFinder. cpp that finds and displays all the seeds of an integer given by the user. Let's define a seed of an integer, n, to be a
positive value that equals n when multiplied by its individual digits. For example, 23 is a seed of 138 because 2323=138.111 is an example of a seed of itseli
because 111111=111. Many numbers have no seeds (e.g.,2) and some numbers have multiple seeds (e.g.,24 and 32 are seeds of 192).
Implement the following functions as parts of your overall solutions:
a. getPositiveWholeNumber: This function asks the user for a positive whole number (integer) repeatedly until the input is correct. The number is then returned.
You can assume that the user will only input whole numbers, but you need to check if they are positive.
b. checkIfSeed: This function takes two parameters: (1) the number that may have seeds and (2) a possible seed to check. The function returns a bool. The
function returns true if the possible seed is in fact a seed of the first parameter; otherwise, the function returns false. The function should first check if the
number is divisible by the possible seed; otherwise, it cannot be a seed and no further checks are necessary. If the number is dividable by the possible seed,
multiply the seed by each of its digits using a loop. Finally, compare that product with a number. Hint: use the modulus operator to extract the last digit of a
number and divide by 10 to remove the last digit of a number.
This function should not get any input from the user or display any information (i.e., do not use cin or cout in this function).
C. findAndDisplaySeeds: This is a void function that accepts a single integer as a parameter. The function should output "The seed(s) of N are:" (but
replacing N with the parameter's value). After that, find and display each seed by looping through each possible seed value for the parameter and using
checkIfseed to see which values should be displayed. Output the word "none" if no seed values were found.
d. The main function should simply display the header "--- Seed Finder ---", call getPositiveWholeNumber(), and then findAndDisplaySeeds(). Also, it
may define any variables that are necessary.
Make sure your program's output matches the format of the example output.
Write a program in a file named SeedFinder. cpp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!