Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop the function PrintValues() which displays the values on the screen for the category specified. The prototype for the function PrintValues() appears below (you must

Develop the function PrintValues() which displays the values on the screen for the category specified. The prototype for the function PrintValues() appears below (you must use the exact prototype shown).

void PrintValues(int values[], int numValues)

The parameter numValues gives how many values are in the array. The function must ask the user which category of values they would like to display. The user will enter one of the following words: ODD, EVEN. If ODD is entered, only odd values are displayed. If EVEN is entered, only even values are displayed. If a category other than the ones listed above is entered, the program simply reports " Invalid Category" and displays no values. The category entered by the user must be in UPPER case.

To determine if a value is odd or even, use the modulus operator (%). Determine the remainder after dividing by 2 (num % 2). If the number is odd, the result will be 1. If the number is even, the result will be 0.

The complete program execution should look something like this:

How many values will be provided? 6 What is value #1? 221 What is value #2? 470 What is value #3? 9 What is value #4? 14 What is value #5? 333 What is value #6? 600 What category would you like to display (ODD, EVEN)? ODD The odd values are: 221 9 333

Note that the question asking how many values will be provided along with the entering of each value must be asked in the function main(). Similarly, the code to ask for the category and display the resulting output of the values in the specified category must be in the function PrintValues().

Do not use any global or file scope variables in your solution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

Explain the factors influencing consumer behaviour.

Answered: 1 week ago