X1184: Codewit Juan: C++ Boolean Operators for Login

Write a program that prompts the user to login, and displays appropriate messages according to whether the details are correct, partially correct, or incorrect:

  • user stores the user input for the username,
  • password stores the user input for the password,
  • login has whether the login is successful or not

The program should then display these messages in their respective cases:

  • If user is juan and password is secret, the login is successful and the message displayed should be:

Login successful!

  • If either the user is not juan OR the password is not secret, the login is unsuccessful and the message displayed should be:

One of the things entered is incorrect

Login failed

  • If both the user and password do not match, the login is unsuccessful and the message displayed should be:

Login failed

Complete the code within the brackets ({ }) below.

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.