Question: C++ Main Program Flow Prompt user for the number 1 to execute Get Max from vector and 2 for Get primes. Prompt user for a

C++

Main Program Flow Prompt user for the number 1 to execute Get Max from vector and 2 for Get primes. Prompt user for a number and return max value or list of primes and display them to screen. ( If user select Get Max, Create a vector in main with initialized values or create an empty vector and prompt user for vector elements in a loop). If user selects Get Primes ask them for a number and call primes vector function. Program continues until user decides to exit.

vectors.h

1. /* Write a value return function prototype get_max_from_vector with a const reference vector of ints parameter that returns an int @param numbers is a const reference to a vector of integers @return the max value in the vector */ 2. /* Write a function prototype named is_prime with an integer parameter thatgiven a number returns true if prime or false if not prime @param number: Any whole number @return: bool if prime False if not */ 3. /* Write a a function prototype named vector_of_primes with an integer parameterthat Given a number returns all the prime numbers up to the number @param int integer value @return vector of ints containing prime values up to a value */
vectors.cpp 4. /* Write a value return function get_max_from_vector with a const reference vector of intsparameter that returns the max value in a vector @param numbers is a const reference to a vector of integers @return the max value in the vector */ 5. /* Write a function named is_prime with an integer parameter that given a number returns true if prime or false if not prime @param number: Any whole number @return: bool if prime False if not */ 6. /* Write a a function named vector_of_primes with an integer parameter that given a number returns all the prime numbers up to the number Example given number 10 returns a vector with elements 2,3,5,7, @param int integer value @return vector of ints containing prime values up to a value Make sure to use the is_prime function to determine if current number is prime. */

main.cpp

7. /* use a vector of int with values 8, 4, 20, 88, 66, 99 Prompt user for 1 for Get Max from vector and 2 for Get primes. Prompt user for a number and return max value or list of primes and display them to screen. Program continues until user decides to exit. */ int main() { return 0; }

Function specifications

Function

Parameters

Return

get_max_from_vector

const reference vector of int

int

is_prime

int

bool

vector_of_primes

int

vector of int

Test Cases Test function get_max_from_vector

Value

Result

vector w values 3,8,1,99,1000

1000

vector w values 15,12,11,99,88

99

vector w values 150,120,11,990,88888

88888

Test is_prime

Value

Result

2

true

4

false

43

true

44

false

Test vector_of_primes

Value

Result

10

vector with values 2, 3, 5, 7

50

vector with values 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47

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 Databases Questions!