+1(978)310-4246 credencewriters@gmail.com

Assignment 4 Functions and Arrays
Based on what you have learned so far, please make the following programs in C++.
1. Make a function named “showMe()” to display your name and school year. After that, use any loop
statements to display them 100 times like below
2. Get one integer, and if it is an even number, display it as “Even Number”. Otherwise, display it as
“Odd Number”. Function declaration is as follows: void isEven (int even)
3. Write a function named “double calVolume(double radius)” that calculates the volume of the
sphere by receiving the radius of the sphere. The math formula to calculate the volume of the sphere
is as follows: V = (4*ℼ*radius3) / 3 where ℼ is 3.14
4. Write a program that simulates a lottery. The program should have an array of five integers named
lottery and should generate a random number in the range of 0 through 9 for each element in the
array. The user should enter five digits, which should be stored in an integer array named user. The
program is to compare the corresponding elements in the two arrays and keep a count of the digits
that match. For example, the following shows the lottery array and the user array with sample
numbers stored in each. There are two matching digits (elements 2 and 4).
Lotter array:
User array:
The program should display the random numbers stored in the lottery array and the number of
matching digits. If all of the digits match, display a message proclaiming the user as a grand prize
Grading Criteria
a. No submission: -5 points per each program
b. If programs do not work properly, deduct -3 points per each program
c. Syntax errors: deduct -0.2 per each syntax error
d. No syntax errors, but does not return correct outputs: -2 points
Due date: By 11:59PM, 6/21/2022
File format: Your last name_assignment 4.cpp

Purchase answer to see full

error: Content is protected !!