+ 2

How can I make a program with loops, for a user to enter an account number?

if the user input characters instead of Numbers how can I use loops to prompt the user to enter an account number?

22nd Apr 2017, 11:53 PM
Theophilus Mashego
Theophilus Mashego - avatar
2 Answers
+ 22
In my quasi-pseudocode: 1.) Declare any variables(i.e.int,char,double) 2.) Maybe use a do while loop(so any residual actions are executed) 3.) Use cout to ask for data from the user. 4.)Store it in a cin variable, or do something with the data like check for int/char input, or if account string exists, and notify user in case of faulty input 5.)Close with a cout "Would you like to alter more data? Press y for yes, and n for no: " 6.)cin for yes or no. 7.) Do while loop will check for y or n 8.) cout "Exiting...", and then exit, or go back to step 3.
23rd Apr 2017, 12:08 AM
David Hutto
David Hutto - avatar