5 intiger
Write a CPP program which:
Prompts the user to enter 5 integers
Validates each user entry to ensure that it is an integer
Stores the user entries in a one-dimensional array of type int
Displays the largest and smallest integer in the array (assume all integers in the array are unique and distinct).
Requirements:
The program must consist of a class called Integers. The class must have:
A public function/method called setUserEntry. This function/method is used to:
Prompt the user for an integer
Invoke a method called validate which verifies that the entry is in fact an integer, if the entry is not an integer, the user is NOT allowed to proceed until he/she
enters an integer.
A public function/method called validate ; which verifies that the entry is in fact an integer, if the entry is not an integer, the user is NOT allowed to proceed
until he/she enters an integer.
The constructor uses a loop to initialize the elements in the array to zero
The displayIntegers function/method is a “const” function/function which takes no parameters and uses a loop to display the values of the array.
The getLargestSmallestIntegers is a function/method which displays the largest and the smallest integers in the array.
The array is of type int, size 5.
The main function must use a loop to keep the user in the program until he/she wants to quit.
You MUST submit The following THREE files:
A separate .h file called Integers.h
A separate .cpp file called IntegersImp.cpp
A separate .cpp file with main()
GENERAL RESTRICTIONS FOR ALL QUIZZES, MIDTERM AND FINAL EXAM
No global variables
No infinite loops, examples include:
for(;;)
while(1)
while(true)
do{//code}while(1);
No break statements to exit loops
See enclosed exe for final program execution.
Please follow the instructions cuz my professor is very strict about it
4.