Professor Hank Stalica | C+ + Tutorial: how to do input validation using while loops. @ProfessorHankStalica | Uploaded 2 years ago | Updated 2 hours ago
I demonstrate how to perform input validation in C++ using a while loop. This is a tutorial for beginners introducing the topic as covered in our textbook.
In other words, we're going to check user input with a while loop.
2:18 ⇒ Theory
3:39 ⇒ Get to the code
Here's the basic algorithm:
Ask for some input
while the input is something we don't like:
Tell the user there something wrong
Ask for the input again
Continue on with the rest of the program
We'll cover the logic, write a sample program, and see what happens if you use if (bad) instead of while (good), a common mistake made by new students. Sample programs are written using Visual Studio 2022.
// Learn More //
C++ Playlist:
https://youtube.com/playlist?list=PLaatXkJEXKyIK736SvHJBY6cc8azGaxXo
while loops:
https://youtu.be/qWcHvXdeDlA
// Consider supporting this channel in multiple ways
https://paypal.me/hankstalica1
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB
I demonstrate how to perform input validation in C++ using a while loop. This is a tutorial for beginners introducing the topic as covered in our textbook.
In other words, we're going to check user input with a while loop.
2:18 ⇒ Theory
3:39 ⇒ Get to the code
Here's the basic algorithm:
Ask for some input
while the input is something we don't like:
Tell the user there something wrong
Ask for the input again
Continue on with the rest of the program
We'll cover the logic, write a sample program, and see what happens if you use if (bad) instead of while (good), a common mistake made by new students. Sample programs are written using Visual Studio 2022.
// Learn More //
C++ Playlist:
https://youtube.com/playlist?list=PLaatXkJEXKyIK736SvHJBY6cc8azGaxXo
while loops:
https://youtu.be/qWcHvXdeDlA
// Consider supporting this channel in multiple ways
https://paypal.me/hankstalica1
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB