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

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 14:10, BardiFan
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
image
Engineering, 04.07.2019 18:10, soreese02
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
image
Engineering, 04.07.2019 18:20, kendrawalraven
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
Answers: 3
image
Engineering, 04.07.2019 19:10, batmanmarie2004
Afoot bridge is made as a simple deck, 4 m long, with a cross section 2 m (wide) and 20 cm thick, and made of wood. the deck is supported at the two ends. the maximum load allowable on the bridge is 10 tons, provided it is uniformly distributed on the deck. to sense this load, a strain gauge is placed at the center of the bridge and its resistance is monitored. if the sensor has a nominal resistance of 350 s2 and a gauge factor of 3.6, what is the reading of the strain gauge at maximum load? the modulus of elasticity for the wood used in the construction is 10 gpa.
Answers: 2
You know the right answer?
Listed below are snippets from a prgram to perform input validation for
a username and passwor...

Questions in other subjects:

Konu
Mathematics, 20.11.2020 07:00
Konu
Mathematics, 20.11.2020 07:00
Konu
Mathematics, 20.11.2020 07:00