Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program that has three files: header, implementation, and main files. The header file contains the following functions' prototypes: 1. void readArray(int a[],
Write a C++ program that has three files: header, implementation, and main files. The
header file contains the following functions' prototypes:
1. void readArray(int a[], constint size)
This function reads the elements of the array from user.
2. void printArray(constint a[], const int size)
This function prints the elements of the array to the screen
3. int searchArray(constint a[], const int size, int number)
This function searches for a number in the array and returns its index (or -1 if not
found)
4. void multiplyByN(int a[], constint size, int element, int N)
This function searches for an element in the array and multiplies it by N.
Hint: Call searchArray() in order to find the index to the required element.
5. int sumEvens(constint a[], const int size)
This function calculates and returns the summation of all even numbers in the passed
array.
implementation.cpp file contains the definitions for the functions which their prototypes
are declared in header.h
In main.cpp:
Define local int array of size 10. Give values to its elements using an initializer
list.
Test your functions in the main program. A menu-driven program with the
following menu could be implemented for this purpose.
1. Read Array.
2. Print Array.
3. Multiply an element of the array by N.
4. Summation of all even numbers.
5. Exit.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started