138k views
1 vote
2. Write a program that checks for a secure password. It

· Has documentation.
· Gets the password inputted by the user.
· Stores the password in an appropriately named variable.
· Checks if the password is “1234”, “1111” or “2222”. If it is, print “User secure.”
· Otherwise, print out “Please input a more secure password.”

User Raju Akula
by
4.6k points

1 Answer

4 votes

Answer:

#include<iostream>

#include<conio.h>

using namespace std;

int main()

{

int password;

cout << "Enter the password = ";

cin>>password;

if (password==1234 || password==1111 || password == 2222)

{

cout <<"User Secure";

}

else

cout<<"Please input more secure password";

getch();

}

Step-by-step explanation:

In this program, a variable of integer data type is stored in password variable. This variable compares with all three values in if statement by using OR(||) operator.

User Vise
by
5.5k points