Starting from:
$30

$24

Name Validator Solution Solution

About This is an extra credit assignment to help with getting back into coding. You may have to review some C++ topics in order to complete this assignment.




Description You will be writing a program that will have the user enter their name, validate it, then save their name into a text le. You will need to know how to get string input, as well as write out to a le and read in from a le. It is also good to know how to de ne and call functions.




Instructions




In C++, create a simple program. Make sure to create an output le stream to work with. (ofstream)




In a main program loop, give the user the choice to enter a name or quit.




When the user selects enter a name, then you will ask them for their full name. It is up to you how you will format the name, but you should be able to read in the le after saving it.




Validate the name entered, such as checking for invalid characters. It would be useful if you made a function that does this, and returns true if valid, and false if invalid. If the name is invalid, have the user enter the name again until they enter a valid name.




Once the name has been validated, save their name to the name text le.




Instructions, pt 2 Once your program works and saves names, you will need to modify the program to read in the names as well. At the beginning of the program, before the main program loop:




Create a vector or array of strings to hold each name from the text le. One element of the array should store a full name.




Load in the names from the text le and store them in the array. Display all of the names from the array.




Begin the main program loop as normal.




Turn in Once you are nished, turn in your .cpp source le on Canvas.



More products