Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ only Code Asks the user to enter his/her name AND validates it Once the name is validated, then the program prompts the user to

C++ only Code 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 QUIZZES, MIDTERM AND FINAL EXAM

No global variables

No labels or go-to statements

No infinite loops, examples include:

for(;;)

while(1)

while(true)

do{//code}while(1);

No break statements to exit loops Please post a working Code For Reference

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions