1. Given a global list of users and password like the following, write a function (called login) that takes a user name and password and logs in the user if login is successful: - the user exists in the list - and the password is correct  The function should return a True/False users = {'Jane': 'Password123@', 'John': 'Password123!'}

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 31SA
icon
Related questions
Question

1. Given a global list of users and password like the following, write a function (called login) that takes a user name and password and logs in the user if login is successful:
- the user exists in the list
- and the password is correct

 The function should return a True/False

users = {'Jane': 'Password123@', 'John': 'Password123!'}


2. Write a function called register that takes a user name and password and adds the user to the list if the user does not already exist in the list
The function should return a True/False

Put it all together:

3. Write a showmenu function that shows the following options and reads the choice from user and returns it:

 1: register
 2: login
 0: logout

3. In the main section, based on the user's selected option, ask the required input (user name, passwords) and perform the requested operation.

4. Repeat the above until the user enters 0. (keep showing the menu that asks for another option)

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning