#Mastery<\/a>15 al over again because i want to get my two points!<\/p>\nI will be teaching you how to use a conditional if.<\/p>\n
First of all lets see why conditionals are useful.<\/p>\n
For me personally, the use of conditionals is one of the most important things in c++ programming or in any kind of language or algorithm. Because is such an easy way to do things, or to lead the user where he wants to go.<\/p>\n
An if or conditional, is to give the user an option if he wants something or no, or also if the user put something he can´t the program will say no, because you said tha IF he put that it will say no.<\/p>\n
But, lets do an example for you to understand it better.<\/p>\n
the syntax for using an if is very easy:<\/p>\n
“if (conditional)<\/p>\n
{<\/p>\n
}”<\/p>\n
Yes, is that simple.<\/p>\n
But let say you ask the user for a number between 1 and 10 and the name of the variable that the user will give us is “num”.<\/p>\n
if (num 10) \/\/This is the condition<\/p>\n
{<\/p>\n
cout\n<\/p>\n
}<\/p>\n
So what did i did here. In words this tell “If the number the user gives is less than 1 or more than 10, then print (Your number is invalid).<\/p>\n
As you can se is very simple and you cant put various times or combine it with for loops, while loops or whatever you want.<\/p>\n
Hope you learn from this!<\/p>\n<\/div>\n
Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,26],"tags":[113,486,40,287],"class_list":["post-14422","post","type-post","status-publish","format-standard","hentry","category-blogs","category-syndicated","category-tc1017blogs","tag-mastery15","tag-tc","tag-tc1017","tag-mastery"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/14422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=14422"}],"version-history":[{"count":6,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/14422\/revisions"}],"predecessor-version":[{"id":19237,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/14422\/revisions\/19237"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=14422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=14422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=14422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}