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
aksik [14]
3 years ago
13

Write a program that asks for a password and then verifies that it meets the stated criteria. • If the password meets the criter

ia, it should state so. • If it doesn’t, the program should display a message telling the user why it failed. • Call your program: MyName-Hwrk10A.cpp . Be sure to put your name as a comment in the code as well as display it in the screen output. • Note, there is no need to give the user a second chance (or more) to type in a different password. The user should simply be told that the password was successful, or why it wasn’t, and then the program can end.
Computers and Technology
1 answer:
inessss [21]3 years ago
4 0

Missing Details in Question

The password criteria are not stated. For this program, I'll assume the following

  • Password must contain at least 1 capital letter
  • Password must contain at least 1 small letter
  • Password must contain at least 1 digit
  • Password must be at least 8 characters

See Attachment for Source File "MyName-Hwrk10A.cpp"

Answer:

// Comment explains difficult lines

#include<iostream>

#include<cstring>

#include<cctype>

using namespace std;

int main()

{

//Enter your name here

int k,l,m;

/*

Integer variables k,l and m are used to count the number of  

capital letters small letters and digits in the input string (password)

*/

//Initialize them to 0

k=0;l=0;m=0;

int length;

string pass;

cout<<"Password: ";

cin>>pass;

//Calculate length of input string

length = pass.length();

//The following variable is declared to determine if the input string meets criteria

int det = 0;

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

{

 if(isupper(pass[i])){ k++;}

 if(islower(pass[i])){ l++;}

 if(isdigit(pass[i])){ m++;}    

}

if(k==0)

{

cout<<"Password doesn't contain capital letters "<<endl;

det++;

}

if(l==0)

{

cout<<"Password doesn't contain small letters "<<endl;

det++;

}

if(m==0)

{

cout<<"Password doesn't contain digit "<<endl;

det++;

}

if(length<8)

{

cout<<"Length of password is less than 8 "<<endl;

det++;

}

if(det == 0)

{

 cout<<"Password meets requirements "<<endl;

}    

 return 0;

}

Download cpp
You might be interested in
g Given a 5 by 5 matrix of all positive values, write a program to find and display the greatest product of the 2 adjacent value
Rom4ik [11]

Answer:

Check the explanation

Explanation:

% iterate through each column (outer loop) , then iterate rows-1 (inner loop)

%take product of adjacent rows

mat = input('enter 5 by 5 matrix : ');

[R,C] = size(mat);

max_prod =0;

for c =[1:C]

for r=[1:(R-1)]

temp = mat(r,c)*mat((r+1),c);

if max_prod<temp

max_prod=temp;

end

end

end

fprintf('Greatest product : %i\n', max_prod)

Kindly check the output in the attached image below.

7 0
3 years ago
What is the Content Tab for?
anygoal [31]

Content Tabs enable Thunderbird to display remote content in a tab, which users can browse in (mostly) the same way as with a browser. For example, invoking Thunderbird's Help. What's New menu option opens a tab that displays web content.

5 0
4 years ago
Read 2 more answers
Using a while loop, create an algorithm extractDigits that prints the individual digits of a positive integer.
sergiy2304 [10]

Answer:

The algorithm is as follows

1. Start

2. Declare Integer N

3. Input N

4. While N > 0:

4.1    Print(N%10)

4.2   N = N/10

5. Stop

Explanation:

This line starts the algorithm

1. Start

This declares an integer variable

2. Declare Integer N

Here, the program gets user input N

3. Input N

The while iteration begins here and it is repeated as long as N is greater than 0

4. While N > 0:

This calculates and prints N modulus 10; Modulus of 10 gets the individual digit of the input number

4.1    Print(N%10)

This remove the printed digit

4.2   N = N/10

The algorithm ends here

5. Stop

<u>Bonus:</u>

The algorithm in Python is as follows:

<em>n = 102</em>

<em>while n>0:</em>

<em>     print(int(n%10))</em>

<em>     n= int(n/10)</em>

<em>    </em>

8 0
3 years ago
What is the internet​
ZanzabumX [31]
<h2>♨ANSWER♥</h2>

The Internet, sometimes called simply "the Net," is a worldwide system of computer networks -- a network of networks in which users at any one computer can, if they have permission, get information from any other computer

<u>☆</u><u>.</u><u>.</u><u>.</u><u>hope this helps</u><u>.</u><u>.</u><u>.</u><u>☆</u>

_♡_<em>mashi</em>_♡_

5 0
2 years ago
Read 2 more answers
Which option correctly completes this statement? Programs can repeat simple instructions very quickly to I. help human users to
inna [77]

Answer:

I, II only

Explanation:

A computer program is a compilation of instructions and commands that can be executed by a computer to carry out a specific task. Most computer devices can only function optimally with the help of a program.

Programs can repeat simple instructions very quickly in order to assist individual users to recognize images and sound effortlessly and to get rid of the drudgery of repeating instructions and commands by hand

5 0
3 years ago
Other questions:
  • What are preconceptions?
    9·2 answers
  • When using the strcat function, you must be careful not to overwrite the bounds of an array?
    5·1 answer
  • The purpose of the ________ element is used to configure the headings for a web page document or section of a web page document.
    11·1 answer
  • A ________ separates traditional voice telephone transmission from the data transmissions in the equipment located at the custom
    11·1 answer
  • Which programming language is good for 14 year old like me​
    12·2 answers
  • A power supply unit for a computer converts:
    7·1 answer
  • How do unstar another user
    14·1 answer
  • Which of the following are TRUE? A function can call another function. As long as the function is defined anywhere in your progr
    14·1 answer
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • Answering a questi
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!