How to prompt user to input data using do while without creating new separate variables for each new data set? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to prompt user to input data using do while without creating new separate variables for each new data set?

For example, if I wanted to get continuous user input on employee roles at a company until user input stops it, how would I do so using the do while loop?

27th Feb 2018, 2:41 AM
Chuck
Chuck  - avatar
4 Answers
+ 1
do { cout <<"Please enter the role:" }while (cin>>role && role!="N") hope it helps
27th Feb 2018, 4:50 AM
Utku Sen
Utku Sen - avatar
0
using do while
27th Feb 2018, 4:39 AM
Chuck
Chuck  - avatar
0
so like I want to do: do while prompt user to continue data for another role or stop to stop entering new role info, user must press 'N'
27th Feb 2018, 4:46 AM
Chuck
Chuck  - avatar
0
thanks for the help
27th Feb 2018, 6:00 AM
Chuck
Chuck  - avatar