i know how to use 'do while loop' to validate cin input for integer or string input. but i have many cin in my cpp file. if i have 10 cin, do i need to use 10 'do while loop' for each cin? is that a better way to validate the input by using only one loop?
You could use a function(possibly overload if you want strings and ints) that is the cin & validation (do/while) and then call that function when ever you want the user to input something. Otherwise if you do not use the do/while it will just move on with a invalid choice and will not ask the user for another