Question: Write a program which performs the following tasks in the order described below (c++): The program uses pneumonic/meaningful variable names and is commented properly Asks
Write a program which performs the following tasks in the order described below (c++):
The program uses pneumonic/meaningful variable names and is commented properly
Asks the user to enter his/her name AND validates it
Once the name is validated, then the program prompts the user to enter anything (s)he wants until user types -1.
The program must create a text file with the users name AND store EVERYTHING the user types in it.
The program must then read the contents of the file and count the number of even digits and the number of odd digits
The program should display the number of even digits if there are any; otherwise it should indicate that there are no even digits.
The program should display the number of odd digits if there are any; otherwise it should indicate that there are no odd digits.
It is VERY important that the program also include the following functions:
void validateUserName(which parameters? pass by reference or by value?);//validate user name
void checkEvenDigit(which parameters? pass by reference or by value?);//check for the presence of even digits
void checkOddDigit(which parameters? pass by reference or by value?);//check for the presence of odd digits
void createFile(which parameters? pass by reference or by value?);//create userFile
void writeDataToFile(which parameters? pass by reference or by value?);//write to the file
void readDataFromFile(which parameters? pass by reference or by value?);//read from the file
void displayResults(which parameters? pass by reference or by value?);//display results
The main() function should consist mostly of local variable declarations and a series of function calls. One of the objectives of the quiz is to get you to modularize your programs using functionshence main() must necessarily be very short!
GENERAL RESTRICTIONS FOR ALL ASSIGNMENTS
No global variables
No infinite loops, examples include:
for(;;;)
while(1)
while(true)
do{//code}while(1);
No break statements to exit loops
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
