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
Listed below are snippets from a prgram to perform input validation for
leva [86]

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;

}

}

3 0
3 years ago
For the reactions of ketone body metabolism, _______.
Artemon [7]

Answer:

Is

Explanation:

7 0
3 years ago
A 2-lane highway is to be constructed across a 6-ft diameter metal culvert which is oriented perpendicular to the highway center
kvv77 [185]

Answer:

Dude just like forget the highway and drive on the interstate bruh

Explanation:

5 0
4 years ago
Explain working of Laser Doppler Vibrometer with diagram.
Klio2033 [76]

Answer:

A laser-Doppler vibrometer  identifies the Doppler effect or shift of laser light reflected from the sample object

Explanation:

A laser-Doppler vibrometer (e.g. Micro Motion Analyzer 400 from Polytec) identifies the Doppler effect or shift of laser light reflected from the sample object .At a beam splitter, a laser beam is partitioned into a measuring beam  and a reference beam that deflects 90 ° upwards and transmit to the reference mirror "RM." Both beams come back to the beam splitter.

6 0
3 years ago
Reference sources reveal that a workpiece material has a unit horsepower of 1.6 hp/in3/min. For a turning operation, the cutting
Troyanec [42]

The question is incomplete. We have to calculate :

a). the cutting force

b). volumetric metal removal rate, MRR

c). the horsepower required at the cut

d). if the power efficiency of the machine tool is 90%, determine the motor horsepower

Solution :

Given :

Cutting velocity (v) = 500 ft/min

                               = 500 x 12 in/min

                               = 6000 in/min

Feed , f = 0.025 in/rev

Depth of cut, d = 0.2 in

b). Volumetric material removal rate, MRR = v.f.d

                                                                      = 6000 x 0.025 x 0.2

                                                                      = 30 $in^3 / min$

c). Horsepower required = MRR x unit horsepower

                                         = 30 x 1.6

                                         = 48 hp

a). Cutting force,

$F=\frac{power}{cuting \ velocity}$

    $=\frac{48 \times 550}{500 /60}$                (1 hp = 550 ft lbf /sec)

   = 3168 lbf

d). Machine HP required

  $=\frac{HP}{\eta}$

 $=\frac{48}{0.9}$

= 53.33 HP

6 0
3 years ago
Other questions:
  • Which of the following types of protective equipment protects workers who are passing by from stray sparks or metal while anothe
    8·1 answer
  • 1. Get the trDFgrouped data starting from the May heavy day counts to the August heavy counts
    12·1 answer
  • A westbound section of freeway currently has three 12-ft wide lanes, a 6-ft right shoulder, and no ramps within 3 miles upstream
    12·1 answer
  • For a turning operation, you have selected a high-speed steel (HSS) tool and turning a hot rolled free machining steel. Your dep
    9·1 answer
  • The steady-state data listed below are claimed for a power cycle operating between hot and cold reservoirs at 1200 K and 400 K,
    5·1 answer
  • The ______ cycle begins with the new moon.
    10·1 answer
  • What is the function rule for the line? f(x)=−32x−2f(x)=−23x−2f(x)=32x−2f(x)=−32x+2A coordinate grid with x and y axis ranging f
    6·1 answer
  • Someone please help me and explain this in detail!!!!!
    9·1 answer
  • A 100 MHz generator with Vg= 10/00 v and internal resistance 50 ohms air line that is 3.6m and terminated in a 25+j25 ohm load
    6·1 answer
  • What factors affect the temperature when vapor condenses
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!