Reference no: EM132207496
Write a program which:
1. Asks the user to enter his/her name AND validates it
2. Once the name is validated, then the program prompts the user to enter anything (s)he wants until user types -1.
3. The program must create a text file with the user's name AND store EVERYTHING the user types in it.
4. The program must then read the contents of the file and count the number of even digits and the number of odd digits
5. The program should display the number of even digits if there are any; otherwise it should indicate that there are no even digits.
6. The program should display the number of odd digits if there are any; otherwise it should indicate that there are no odd digits.
7. The program MUST have the following functions:
void validateUserName(which parameters? pass by reference or by value?);//validate user name
void validateUserInput(which parameters? pass by reference or by value?);//validate user input
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
8. 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 functions-hence 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