Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":25285,"date":"2015-10-28T21:14:51","date_gmt":"2015-10-29T03:14:51","guid":{"rendered":"http:\/\/myfreakingcrazythoughts.wordpress.com\/?p=152"},"modified":"2015-10-28T21:14:51","modified_gmt":"2015-10-29T03:14:51","slug":"use-of-if-and-else-in-c","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/use-of-if-and-else-in-c\/","title":{"rendered":"Use of IF and ELSE in C++"},"content":{"rendered":"

IF.<\/strong><\/p>\n

As you might know, an if statement is the one that allows the user to control if a program enters a section of code or not based on whether a given condition is true or false. One of the important functions of the if statement <\/strong>is that it allows the program to select an action based upon the user’s input.<\/p>\n

Without a conditional statement such as the if statement, programs would run almost the exact same way every time. If statements allow the flow of the program to be changed, and so they allow algorithms and more interesting code.<\/p>\n

When using an If statement <\/strong>it is important to know that the possible return will always be true <\/strong>or false, <\/strong>according to the parameters that the user gave to the program. This parameters will be declared with operators which are the ones who check if the condition is true or false.<\/p>\n

For example:<\/p>\n

<\/p>\n

\n
><\/span>     Greater<\/span> than<\/span>              5<\/span> ><\/span> 4<\/span> is<\/span> TRUE<\/span>\n\n<<\/span>     Less<\/span> than<\/span>                 4<\/span> <<\/span> 5<\/span> is<\/span> TRUE<\/span>\n\n>=<\/span>    greater<\/span> than<\/span> or<\/span> equal<\/span>     4<\/span> >=<\/span> 4<\/span> is<\/span> TRUE<\/span>\n\n<=<\/span>    less<\/span> than<\/span> or<\/span> equal<\/span>        3<\/span> <=<\/span> 4<\/span> is<\/span> TRUE<\/span>\n\n==<\/span>    Equal<\/span> to<\/span>                  5<\/span> ==<\/span> 5<\/span> is<\/span> TRUE<\/span>\n\n!=<\/span>    not<\/span> equal<\/span> to<\/span>              5<\/span>!<\/span> =<\/span> 4<\/span> is<\/span> TRUE<\/span>\n<\/pre>\n<\/div>\n

When a condition is true the result will be 1 and when the condition result to be negative the return will be 0.<\/p>\n

\u00a0<\/strong><\/p>\n

Basic structure of an IF statement.<\/strong><\/p>\n

\n
If<\/span> (TRUE)<\/span> {<\/span>\n\nExecute<\/span> the<\/span> next<\/span> statement}<\/span>\n<\/pre>\n<\/div>\n

\u00a0<\/strong><\/p>\n

As you can see, the structure is pretty clear. Inside the parenthesis there are the conditions and outside there are the actions that the program will do if the statement is true.<\/p>\n

ELSE.<\/strong><\/p>\n

This statement works when we want to give an alternative response when our IF condition results to be false. So this statement basically says what we want to do if our first statement isn\u2019t true.<\/p>\n

An ELSE structure will look like this:<\/p>\n

\n
If<\/span> (TRUE)<\/span> {<\/span>\n\n  \/\/ execute these statements if TRUE<\/span>\n\n}<\/span>\n\nElse<\/span> {<\/span>\n\n  \/\/ execute these statements if FALSE<\/span>\n\n}<\/span>\n<\/pre>\n<\/div>\n

ELSE IF.<\/strong><\/p>\n

But what happen if we want to declare two or more conditions of IF? <\/strong>That is the situation when we use ELSE IF. When we use an “else if” statement following an if statement and its body; that way, if the first statement is true, the “else if” will be ignored, but if the if statement is false, it will then check the condition for the else if statement. If the if statement was true the else statement will not be checked. It is possible to use numerous else if statements to ensure that only one block of code is executed.<\/p>\n

For example:<\/p>\n

<\/p>\n

\n
If<\/span> (<condition>)<\/span> {<\/span>\n\n\/\/ execute these statements if <condition> is TRUE<\/span>\n\n}<\/span>\n\nElse<\/span> if<\/span> (<another<\/span> condition>)<\/span> {<\/span>\n\n\/\/ execute these statements if <another condition> is TRUE and<\/span>\n\n\/\/ <condition> is FALSE<\/span>\n\n}<\/span>\n<\/pre>\n<\/div>\n

Thank’s for the support of cprogramming.com<\/a>, it really helped me a lot!<\/p>\n

-The admin.<\/p>\n

\"\"<\/a> \"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

IF. As you might know, an if statement is the one that allows the user to control if a program enters a section of code or not based on whether a given condition is true or false. One of the… Continue Reading →<\/a>\"\"<\/p>\n","protected":false},"author":259,"featured_media":25284,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[582,194,192,113,114,206,62,152,617,615],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25285"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/259"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=25285"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25285\/revisions"}],"predecessor-version":[{"id":25286,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25285\/revisions\/25286"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media\/25284"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=25285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=25285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=25285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}