#Mastery27

When you validate inputs, you allow that the program works better because all the things that the user writes will be evaluated before to executed a part of code.

In this picture you can see some examples of validating input, one of them validates a “char” and the other an “int”.

Is useful to know that in this example I used “DO-WHILE” to validate the input but you can validate inputs using “FOR”, “WHILE”, “IF”and more…

In the following picture you will see the program working, and you can realize that validating input is really useful to avoid that your program has bugs.

In this link you will find a pp that I did to explain validating input with more detail: https://drive.google.com/file/d/0B-NM4ghaDXBvZzRXNlpqR0I1UXM/view?usp=sharing

And here you will find my C++ code: https://drive.google.com/file/d/0B-NM4ghaDXBvTnNITkxPVXRwRzQ/view?usp=sharing

Finally, in this link I found information that helped me to uderstand the logic for this process: http://stackoverflow.com/questions/2075898/good-input-validation-loop-using-cin-c

CC BY 4.0 #Mastery27 by Tania Pardo is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.