This Programming Project explores how the unnamed namespace works. Listed are snippets from a program to perform input validation for a username and password. The code to input and validate the username is in a separate file than the code to input and validate the password.
File header user.cpp:
Define the username variable and the isValid() function in the unnamed namespace so the code will compile. The isValid() function should return if username contains exactly eight letters. Generate an appropriate header file for this code.
Solution to Programming Project
Repeat the same steps for the file password.cpp, placing the password variable and the isValid() function in the unnamed namespace. In this case, the isValid() function should return true if the input password has at least eight characters including at least one non-letter:
File header password.cpp:
At this point, you should have two functions named isValid(), each in different unnamed namespaces. Place the following main function in an appropriate place. The program should compile and run.
Test the program with several invalid usernames and passwords.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.