You’re welcome, I’m glad to hear this helped you out! :-)
@クリスチャン-y5fАй бұрын
Thank you bro
@sekke-c4f Жыл бұрын
The video helps a lot thanks, but i have 1 question though why would you put the same condition on both if else statement and the while?
@PortfolioCourses Жыл бұрын
The if-statement and condition there is to output the error message, the loop and condition there is to keep the loop going and ask the user to input the month again if the input was invalid. :-)
@210matrix Жыл бұрын
simple and informative. Thanks
@PortfolioCourses Жыл бұрын
You’re welcome! :-)
@jonnymcgrath4816 Жыл бұрын
How can I do the same for multiple input? (Im saying if I want to do for another loop for input validation?)
@PortfolioCourses Жыл бұрын
You could put one loop after the other, one at a time for each input. :-)
@jonnymcgrath4816 Жыл бұрын
@@PortfolioCourses thx for the fast response :)
@PortfolioCourses Жыл бұрын
You're welcome! :-)
@abdulhamidfayziyev92932 жыл бұрын
Please can you do this problem and make video. "Write C++ program to print the following triangle of numbers where the example height depends on user input. In case 0 is entered , print the depth is 0. Use for loop" .
@PortfolioCourses2 жыл бұрын
Maybe Abdulhamid, but what does the triangle of numbers look like though? It says "the following triangle of numbers" but there is no triangle of numbers.
@abdulhamidfayziyev92932 жыл бұрын
@@PortfolioCoursesfor example if you input 4 , output should look like this 4444 333 22 1
@PortfolioCourses2 жыл бұрын
@@abdulhamidfayziyev9293 Hmm maybe I can do this, that doesn't seem too bad. 🙂
@abdulhamidfayziyev92932 жыл бұрын
@@PortfolioCourses when will you do this brother?
@abdulhamidfayziyev92932 жыл бұрын
@@PortfolioCourses can you do this within 15 hours.
@MuhammadUsman-mk4ii9 ай бұрын
What if we use string
@ibrahimalnajjar277Ай бұрын
Error
@Sizdothyx Жыл бұрын
What if I want to initiate this loop in the case of other invalid characters as well? As in, let's say I only want a number between 1-5, but putting in a character such as "a", I find, still doesn't activate the loop. The program acts as if it's a valid input.
@PortfolioCourses Жыл бұрын
Great question! This loop is only setup to handle int values. If we wanted to handle any type of input, we could accept the user input as a string, perhaps by using getline: kzbin.info/www/bejne/paWVd6yriZqrpsk. We could then parse the string to first see if it contains a valid int value at all before checking to see if the int value is in range, perhaps using a simple technique such as this: www.tutorialspoint.com/how-to-check-if-a-c-cplusplus-string-is-an-int. 🙂