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":25206,"date":"2015-10-28T20:00:46","date_gmt":"2015-10-29T02:00:46","guid":{"rendered":"http:\/\/opezaimd.tumblr.com\/post\/132120844645"},"modified":"2015-10-28T20:00:46","modified_gmt":"2015-10-29T02:00:46","slug":"mastery-21","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/mastery-21\/","title":{"rendered":"Mastery 21"},"content":{"rendered":"

On this mastery I will show you what is recursion in C++ and how to use it.<\/p>\n

Recursion is a form where a function calls itself. When you call the same function, you are doing a loop, and you have to give a condition in order to make this loop stop.<\/p>\n

Let\u2019s create the same program we did on mastery 20<\/a>\u00a0<\/i><\/b>but now using recursion and a function.<\/p>\n

So, do as follows:<\/p>\n

    \n
  1. Create a function of type long (this allows us to have bigger outputs of the numbers) and add a n <\/b>variable to it.<\/li>\n
  2. Create an if and else if condition as we learn on masteries 15 & 16<\/a><\/i><\/b><\/li>\n
  3. If n <\/b>equals to 0, factorial = 1. (That\u2019s a rule)<\/li>\n
  4. Else if, n<\/b> multiplied by factorial of (n-1). [This is the recursion part of the program, we are calling the function inside the function n times and subtracting 1 every time the loop is done, and it will stop until n <\/b>equals to 0.]<\/li>\n
  5. Inside int main (), declare a variable and ask the user for it, then simply call the function.<\/li>\n<\/ol>\n

    Your program should look something like this:<\/p>\n

    \"image\"<\/figure>\n

    Now let\u2019s test the program. Factorial of 5 should be equal to 120.<\/p>\n

    \"image\"<\/figure>\n

    And that\u2019s about it, you just learned how to use recursion with a function, congrats!<\/p>\n","protected":false},"excerpt":{"rendered":"

    On this mastery I will show you what is recursion in C++ and how to use it.<\/p>\n

    Recursion is a form where a function calls itself. When you call the same function, you are doing a loop, and you have to give a condition in order to make this loop stop.<\/p>\n

    Let’s create the same program we did on mastery 20<\/a> <\/i><\/b>but now using recursion and a function.<\/p>\n

    So, do as follows:<\/p>\n

      \n
    1. Create a function of type long (this allows us to have bigger outputs of the numbers) and add a n <\/b>variable to it.<\/li>\n
    2. Create an if and else if condition as we learn on masteries 15 & 16<\/a><\/i><\/b><\/li>\n
    3. If n <\/b>equals to 0, factorial = 1. (That’s a rule)<\/li>\n
    4. Else if, n<\/b> multiplied by factorial of (n-1). [This is the recursion part of the program, we are calling the function inside the function n times and subtracting 1 every time the loop is done, and it will stop until n <\/b>equals to 0.]<\/li>\n
    5. Inside int main (), declare a variable and ask the user for it, then simply call the function.<\/li>\n<\/ol>\n

      Your program should look something like this:<\/p>\n

      \"image\"<\/figure>\n

      Now let’s test the program. Factorial of 5 should be equal to 120.<\/p>\n

      \"image\"<\/figure>\n

      And that’s about it, you just learned how to use recursion with a function, congrats!<\/p>\n","protected":false},"author":230,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[219,335,40,611],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25206"}],"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\/230"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=25206"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25206\/revisions"}],"predecessor-version":[{"id":25207,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25206\/revisions\/25207"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=25206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=25206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=25206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}