Engineering, 24.03.2020 05:32 Kate1678
Listed below are snippets from a prgram to perform input validation for
a username and password. The code to input and validate the username is
in a seperate file than the code to input and validate the password.
Partial code from user. cpp:
namespace Authenticate
{
void inputUserName(){
do
{
cout << "Enter your username (8 letters only)" << endl;
cin >> username;
}
while(!isvalid());
}
string getUserName()
{
return username;
}
}
Define the username variable and the isValid() function in the
unnamed namespace so the code will compile. The isValid() function
should return true if username contians exactly eight letters.
Generate an appropriate header file for the code.
Repeat rhe same steps for the file password. cpp, placing the password
variable and the isValid() function in the unnamed namespace:
namespace Athenticate
{
void inputPassword(){
do
{
cout << "Enter your password (at least 8 characters " <<
"and at leat one non-letter)" << endl;
cin >> password;
}
while(!isValid());
}
string getPassword()
{
return password;
}
}
For passwords, isValid() should require the passwrod to have eight or
more letters and at leat one non-letter, Generate an appropriate header
file for this code as well.
At this pont, you should have two functions named isValid(), each in
different namesapcs. Place the following main function in an appopriate
place. The program should comile and run.
int main()
{
intputUserName();
inputPassword();
cout << "Your username is " << getUserName() <<
"and your password is: " <<
getPassword() << endl;
return 0;
}
Answers: 3
Engineering, 04.07.2019 03:10
What precautions should you take to prevent injuries when dealing with heavy loads?
Answers: 1
Engineering, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
Answers: 2
Engineering, 04.07.2019 18:10
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
Engineering, 04.07.2019 18:10
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
Listed below are snippets from a prgram to perform input validation for
a username and passwor...
a username and passwor...
Chemistry, 29.01.2021 18:10
English, 29.01.2021 18:10
History, 29.01.2021 18:10
Chemistry, 29.01.2021 18:10
Mathematics, 29.01.2021 18:10
English, 29.01.2021 18:10
Mathematics, 29.01.2021 18:10
Biology, 29.01.2021 18:10
Chemistry, 29.01.2021 18:10
English, 29.01.2021 18:10
Mathematics, 29.01.2021 18:10
History, 29.01.2021 18:10
History, 29.01.2021 18:10