subject
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;
}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Explain the difference laminar and turbulent flow. explain it with the shear stress and the velocity profiles.
Answers: 1
question
Engineering, 03.07.2019 14:10
When at a point two solid phase changes to one solid phase on cooling then it is known as a) eutectoid point b) eutectic point c) peritectic point d) peritectoid point
Answers: 3
question
Engineering, 04.07.2019 18:10
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
question
Engineering, 04.07.2019 18:10
The higher the astm grain-size number, the coarser the grain is. a)-true b)-false
Answers: 3
You know the right answer?
Listed below are snippets from a prgram to perform input validation for
a username and passwor...
Questions
question
Mathematics, 10.11.2020 02:10
question
Mathematics, 10.11.2020 02:10
question
Mathematics, 10.11.2020 02:10
question
Mathematics, 10.11.2020 02:20
question
Chemistry, 10.11.2020 02:20
question
Mathematics, 10.11.2020 02:20
question
Mathematics, 10.11.2020 02:20
question
English, 10.11.2020 02:20
question
Social Studies, 10.11.2020 02:20
question
Mathematics, 10.11.2020 02:20
Questions on the website: 13722362