Write a C++ program that takes ID from the user. Based on the ID determine the role and display appropriate messages to ask the user to enter his/her password (if the role is a student then display “Dear student please enter your password). If the password provided by the user is correct the program will print the greeting message, otherwise, the program will display an error message “You have entered an incorrect value” and the program ends. If the ID does not exist, the program will print Incorrect ID. This should be done using switch and nested switch only.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Given below is a table where each ID has a role assigned to it and a password, corresponding to that ID:
ID | Roll no | Password |
100 | student | 10220 |
101 | student | 16010 |
102 | student | 11002 |
103 | student | 22342 |
104 | student | 44323 |
105 | student | 33354 |
106 | student | 87685 |
107 | student | 99089 |
108 | student | 34562 |
109 | student | 44255 |
110 | teacher | 32415 |
111 | teacher | 90784 |
112 | teacher | 78685 |
113 | IT staff | 15254 |
114 | IT staff | 81973 |
Write a C++
This should be done using switch and nested switch only.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images