1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
seropon [69]
3 years ago
5

Listed below are snippets from a prgram to perform input validation for

Engineering
1 answer:
leva [86]3 years ago
3 0

Answer:

#include <iostream>

#include <string>

#include "user.h"

#include "password.h"

using namespace Authenticate;

using namespace std;

int main()

{

inputUserName();

inputPassword();

cout << "Your username is " << getUserName() <<

" and your password is: " <<

getPassword() << endl;

return 0;

}

user.h:

#ifndef USER_H

#define USER_H

#include <string>

using namespace std;

namespace Authenticate

{

namespace

{

bool isvalid();

}

void inputUserName();

string getUserName();

}

#endif

user.cpp:

#include <iostream>

#include "user.h"

namespace Authenticate

{

string username="";

namespace

{

bool isvalid()

{

if(username.length() == 8)

return true;

else

return false;

}

}

void inputUserName(){

do

{

cout << "Enter your username (8 letters only)" << endl;

cin >> username;

}

while(!isvalid());

}

string getUserName()

{

return username;

}

}

password.h:

#ifndef PASSWORD_h

#define PASSWORD_h

#include <string>

using namespace std;

namespace Authenticate

{

namespace

{

bool isValid();

}

void inputPassword();

string getPassword();

}

#endif

password.cpp:

#include <iostream>

#include <string>

using namespace std;

namespace Authenticate

{

string password="";

namespace

{

bool isValid()

{

if(password.length() >= 8)

{

for(int i=0; i<password.length(); i++)

if(password[i] >= '0' && password[i] <= '9')

return true;

return false;

}

else

return false;

}

}

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;

}

}

You might be interested in
Find At Least Three Instances Of Set Constructions In Your CS Courses And Use Them To Exhibit All Set Operations Discussed In Cl
hoa [83]

An expertly designed format for arranging, processing, accessing, and storing data is called a data structure.

Data structures come in both simple and complex forms, all of which are made to organize data for a certain use. Users find it simple to access the data they need and use it appropriately thanks to data structures. The organizing of information is framed by data structures in a way that both machines and people can better grasp. A data structure may be chosen or created in computer science and computer programming to store data in order to be used with different methods. In some circumstances, the design of the data structure and the algorithm's fundamental operations are closely related. Each data structure comprises information about the data values, relationships between the data and — in some situations — functions that can be applied to the data. For instance, in an object-oriented programming language, the data structure and its related methods are tied together as part of a class description. Although they may be designed to operate with the data structure in non-object oriented languages, these functions are not considered to be a part of the data structure. A data structure may be chosen or created in computer science and computer programming to store data in order to be used with different methods. In some circumstances, the design of the data structure and the algorithm's fundamental operations are closely related. Each data structure comprises information about the data values, relationships between the data and — in some situations — functions that can be applied to the data.

Know more about data structure here:

brainly.com/question/29487957

#SPJ4

4 0
1 year ago
Can high throttle torque tend to open the throttle plate
koban [17]

Answer:

no

Explanation:

7 0
3 years ago
Tech a says that the weight of the flywheel smoothest out the engines power pulses. Tech B says that the flexplate and torque co
lakkis [162]

Answer:

both statement is correct

Explanation:

Flywheel engine uses to reduce fluctuations.

And                                                                

FlexPlate is a metal disk that connects the output from the engine to the input of the torque converter. This will replace the flywheel

so that both statement is correct

4 0
3 years ago
In Illinois, once a person has obtained their boating education certificate what is the minimum age to operate a motorized vesse
bixtya [17]

Answer:

I dont really know, I am sorry, but I am going to ask my teacher

5 0
3 years ago
Read 2 more answers
An office building is served by an air-cooled chiller currently operating at 115 tons (404.5 kW). The measured chilled water sup
Andrei [34K]

Answer:

B.197 gpm and 12.4 L/s

Explanation:

Given that

Load Q = 404.5 KW

Water inlet temperature= 6.1 °C

Water outlet temperature= 13.9°C

We know that specific heat for water

C_p=4.187\ \frac{KJ}{kg.K}

Now from energy balance

Q=\dot{m}C_p\Delta T

by putting the values

Q=\dot{m}C_p\Delta T

404.5=\dot{m}\times 4.187(13.9-6.1)

\dot{m}=12.38\ \frac{kg}{s}     (1 Kg/s = 15.85 gal/min)

We can say that

\dot{m}=196.31\ \frac{gal}{min}

We know that

\dot{m}=\rho\times volume\ flow\ rate

12.38=1000 x volume flow rate

volume\ flow\ rate\ = 12.38\times 10^{-3}\ \frac{m^3}{s}

So

volume flow rate = 12.38 L/s

So the option B is correct.

8 0
3 years ago
Other questions:
  • An aluminum cylinder bar ( 70 GPa E m = ) is instrumented with strain gauges and is subject to a tensile force of 5 kN. The diam
    9·1 answer
  • The device whose operation closely matches the way the clamp-on ammeter works is
    8·1 answer
  • A ceramic material can be defined as an organic compound consisting of a metal or semimetal and one or more nonmetals: (a) true
    9·1 answer
  • A Carnot engine has a piston displacement volume of 7.5 liters. The volume at the beginning of heat addition is 1.0 liters, the
    14·1 answer
  • A bus travels the 100 miles between A and B at 50 mi/h and then another 100 miles between B and C at 70 mi/h.
    6·1 answer
  • PLEASE ANSWER SOON
    7·1 answer
  • You rent an apartment that costs $1800 per month during the first year, but the rent is set to go up 11,5% per year. What would
    12·1 answer
  • What is the heart of a set of construction drawing?
    10·1 answer
  • What is the volume of the rectangular prism shown.
    9·1 answer
  • Disconnecting a circuit while in operation can create a voltage blank
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!