For this quiz we had to create two programs.<\/p>\n
In the first one we had to write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power of the second.<\/p>\n
For example, superpower (3, 4) would return 81.<\/p>\n
And in the second program we wrote a function called stars that has one parameter of type int and prints (the function does not return anything) that many stars on a single line followed by a end-of-line character, so if we call the function with stars (5), the function will print like this:<\/p>\n
*****<\/strong><\/p>\n At first it was hard to write this codes but then, when I looked for help I could notice that actually they were pretty easy and with a few minutes of reading I could understand a little bit more about how the functions work.<\/p>\n You can check the codes at the bottom of this post or in my GitHub account in the Quizzes Repository<\/a>, it’s up to you!<\/p>\n Here are the codes of my two programs.<\/p>\n SuperPower!<\/strong><\/p>\n <\/p>\n Stars!<\/strong><\/p>\n <\/a> <\/p>\n","protected":false},"excerpt":{"rendered":" For this quiz we had to create two programs. In the first one we had to write a function called superpower that has two parameters of type long and returns a long which is first parameter raised to the power… Continue Reading →<\/a><\/p>\n","protected":false},"author":259,"featured_media":24450,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[582,206,619,633,152,617,729,615],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/24451"}],"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=24451"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/24451\/revisions"}],"predecessor-version":[{"id":24452,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/24451\/revisions\/24452"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media\/24450"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=24451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=24451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=24451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}#include <iostream><\/span>\n#include <cmath><\/span>\n\nusing<\/span> namespace<\/span> std;<\/span>\n\nlong<\/span> superpower<\/span> (<\/span>long<\/span> a,<\/span> long<\/span> b){<\/span>\n long<\/span> superpower<\/span> =<\/span> 0<\/span>;<\/span>\n superpower<\/span> =<\/span> pow(a,b);<\/span>\n return<\/span> superpower;<\/span>\n}<\/span>\n\nint<\/span> main<\/span> (){<\/span>\n cout<<<\/span> superpower(<\/span>3<\/span>,<\/span>4<\/span>)<\/span> <<endl;<\/span>\n\n return<\/span> 0<\/span>;<\/span>\n\n}<\/span>\n<\/pre>\n<\/div>\n
#include <iostream><\/span>\nusing<\/span> namespace<\/span> std;<\/span>\n\nvoid<\/span> stars<\/span>(<\/span>int<\/span> iStars){<\/span>\n for<\/span> (<\/span>int<\/span> i<\/span> =<\/span> 1<\/span> ;<\/span> i<\/span> <=<\/span> iStars;<\/span> i++){<\/span>\n cout<\/span> <<<\/span> \"*\"<\/span>;<\/span>\n }<\/span>\n cout<\/span> <<<\/span> endl;<\/span>\n\n}<\/span>\n\nint<\/span> main<\/span>(){<\/span>\n stars(<\/span>5<\/span>);<\/span>\n return<\/span> 0<\/span>;<\/span>\n}<\/span>\n<\/pre>\n<\/div>\n