Home
Answered Questions
Computer Science
In C++ Programming Write A Program In A File Named SeedFinder.cpp That Finds And Displays All The Se

In C++ Programming

Write a program in a file named SeedFinder.cpp that finds and
displays all the seeds of a 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 23 × 2 × 3 = 138.
111 is an example of a seed of itself because 111 × 1 × 1 × 1 =
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:

- 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.
- checkIfSeed: This function takes two parameters: (1) the number
with possible seeds and (2) a possible seed to check. The function
returns a bool. The function returns true if the possible seed is
in face 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, multiple the seed by each of its digits using a
loop. Finally, compare that product with 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). - 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.
- 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 programs output matches the format of the example output.

Sample Output (user input is in yellow)

--- Seed Finder --- Enter a positive whole number: -1 Enter a positive whole number: 0 Enter a positive whole number: 24 The seed(s) of 24 are: 12.

Sample Output (user input is in yellow)

--- Seed Finder --- Enter a positive whole number: 289 The seed(s) of 289 are: none.

Sample Output (user input is in yellow)

--- Seed Finder --- Enter a positive whole number: 549504 The seed(s) of 549504 are: 1696 2862 3392 3816.

ACTIONS

CODE #include