Question: Write a C + + program that checks if the password is correct. The password is a 4 - digit number combination. The program repeats

Write a C++ program that checks if the password is correct. The password is a 4-digit number
combination. The program repeats to ask the password until the password is correct or you enter -1 to exit.
You will use this program:
#include
using namespace std;
int main(){
int const password =1123;
// while loop statement
......
return 0;
}
Input: The password is set to 1123. A user input the password to proceed, or -1 to exit.
Sample Output: The program should display the following output. (The red text is a user input.)
Test case 1: when you enter the correct password.
Enter the password (or -1 to exit): 1234
Password is incorrect.
Enter the password (or -1 to exit): 1123
Password is correct.
Test case 2: when you exit the program.
Enter the password (or -1 to exit): -1
You exit the program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!