#How to display login screen after an option is finished

4 messages · Page 1 of 1 (latest)

lost wave
#

So I'm creating a virtual ATM for my machine project, and I am stumped on how to display the login screen after an option.

When you run the program, you are prompted to a login screen where you'll have to input your account number and PIN, and after a successful login, you are directed to the main menu which displays all the options you can choose from.
The instructions tell me to create an option that prompts the user to change their ATM PIN, and after a successful change, they will be required to re-login. Right now, my code just returns 0; after changing the PIN.

My question is, after a successful PIN change, how do I redirect the user back to the main menu? (I would also appreciate any recommendations on how to improve my code, thanks!)

Side note: the topics we've currently covered are functions, pointers, conditionals, and iterations.

vivid tinselBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#
Dimwit Flathead
Please Do Not Send Screenshots or Photos!

They're hard to read and prevent copying and pasting.

lapis osprey
#

You said you've covered functions.
So use them.

Have a function named bool login(int accnum) for example.
Have it return true if the user enters the accnum correctly within 3 attempts, return false in all other scenarios.

Set yourself a general rule - not a hard and fast one - to not have functions exceed X lines of code.

It helps you spot opportunities to break up your code into functional areas.