{"id":30556,"date":"2016-02-08T22:59:16","date_gmt":"2016-02-09T04:59:16","guid":{"rendered":"http:\/\/canadamike17.wordpress.com\/?p=201"},"modified":"2016-02-09T00:28:44","modified_gmt":"2016-02-09T06:28:44","slug":"wsq08-functions-beach","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq08-functions-beach\/","title":{"rendered":"#WSQ08 Functions Beach"},"content":{"rendered":"<p>Hey so for this new assigment we had to do Fun With Numbers again, but this time we needed to create a function before we asked the user for the numbers; therefore the structureyou must follow is:<\/p>\n<p><span style=\"color:#ff0000;\">int add (int a, int b)<\/span><br \/>\n<span style=\"color:#ff0000;\">{<\/span><br \/>\n<span style=\"color:#ff0000;\">\u00a0\u00a0 \u00a0int s;<\/span><br \/>\n<span style=\"color:#ff0000;\">\u00a0\u00a0 \u00a0s=a+b;<\/span><br \/>\n<span style=\"color:#ff0000;\">\u00a0\u00a0 \u00a0return s;<\/span><br \/>\n<span style=\"color:#ff0000;\">}<\/span><\/p>\n<p>That&#8217;s the main structure for each function, you must do this for the substraction, division, and integer division, remember to change the letter or name for each function though.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-213\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/bbda3998ccd9aca36d9d61490617b3af.jpg\" alt=\"Screenshot7.1.png\"   \/><\/p>\n<p>Then you can proceed to begin with the main program, where you&#8217;d be asking for the numbers who will be used\u00a0 :<\/p>\n<p><span style=\"color:#ff0000;\">int main ()<br \/>\n{<br \/>\nint a, b, s, r, m, d, i;<br \/>\ncout&lt;&lt; &#8220;Give me a integer number&#8221; &lt;&lt; endl;<br \/>\ncin&gt;&gt;a;<br \/>\ncout&lt;&lt; &#8220;Give me second integer number&#8221; &lt;&lt; endl;<br \/>\ncin&gt;&gt;b;<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-219\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/d713b6682dcad3b59316c9bf1b34f915.jpg\" alt=\"Screenshot7.2.png\"   \/><\/p>\n<p>There you can see that we choose our functions created before, and showing that the integers which are going to be use are the ones choosen before; finally we print the answers using <span style=\"color:#ff0000;\">&#8220;cout&#8221; <span style=\"color:#333399;\">finally ending with the <span style=\"color:#ff0000;\">&#8220;<\/span><span style=\"color:#ff0000;\">return 0; &#8220;<\/span><\/span><\/span><\/p>\n<p><a href=\"https:\/\/gist.github.com\/CanadaMike17\/ab2f4d1c9639bd36edab\">Heres is my code<\/a>, in case you need it<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/canadamike17.wordpress.com\/201\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/1e933ed34244441e1a0363d3a20affaa.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/4c8dd3c9ff76239a4138addc8eb40692.jpg#038;blog=105223273&#038;%23038;post=201&#038;%23038;subd=canadamike17&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey so for this new assigment we had to do Fun With Numbers again, but this time we needed to create a function before we asked the user for the numbers; therefore the structureyou must follow is: int add (int a, int b) { \u00a0\u00a0 \u00a0int s; \u00a0\u00a0 \u00a0s=a+b; \u00a0\u00a0 \u00a0return s; } That&#8217;s the &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq08-functions-beach\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">#WSQ08 Functions Beach<\/span><\/a><\/p>\n","protected":false},"author":13,"featured_media":30558,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[63,31,126,51],"class_list":["post-30556","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-paint","tag-tc101","tag-wsq08","tag-homework"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=30556"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30556\/revisions"}],"predecessor-version":[{"id":30564,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30556\/revisions\/30564"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/30558"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=30556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=30556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=30556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}