{"id":35465,"date":"2016-04-07T15:28:17","date_gmt":"2016-04-07T20:28:17","guid":{"rendered":"http:\/\/antonioangelm.wordpress.com\/?p=240"},"modified":"2016-04-07T16:38:53","modified_gmt":"2016-04-07T21:38:53","slug":"quiz-5-14","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/04\/quiz-5-14\/","title":{"rendered":"Quiz 5"},"content":{"rendered":"<p>These are the instructions:<\/p>\n<ol>\n<li>Create a function called is_palindrome which receives a string as a parameter and\u00a0returns true if that string is a palindrome, false otherwise. Remember that a palindrome\u00a0is a word that is the same forward or backward. For full points your function must ignore\u00a0case and must work with any character (not just letters).\u00a0So (\u201cDad$dad\u201d is a palindrome even though the D is capital and d is lower case).<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-245\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/310f354254991788998c4a6626659b05.jpg\" alt=\"Captura de pantalla 2016-04-07 a las 14.56.49\"   \/><\/p>\n<p>In this code, you will need strings, and arrays and also the for loop.<br \/>\nYou&#8217;ll need to add this library #include &lt;string&gt;<\/p>\n<p>Now to know if it the word is a palindrome, the code must be like this:<br \/>\nint large = word.length();<br \/>\nfor (int x = large &#8211; 1; x &gt;= 0; x&#8211;){<br \/>\nbackwards += word[x];<br \/>\n}<\/p>\n<p>the word.length() returns the length of the string, in terms of bytes. So for the &#8220;For&#8221; loop the loop will be adding the last letter to the first of the word, one by one, and save it in &#8220;backwards&#8221;. And if the word and backwards are the same, then that is a palindrome.<\/p>\n<p>You can take a look on this web page.\u00a0http:\/\/www.cplusplus.com\/reference\/string\/string\/length\/<\/p>\n<p>And the <a href=\"https:\/\/github.com\/antonioangelm24\/TC101\/blob\/master\/Quiz%205_a\">Code<\/a> in GitHub<\/p>\n<ol>\n<li>Create a function called find_threes that receives as a parameter a list (or Vector or array for C++ students) of numbers and\u00a0returns the sum of all numbers in that list that are evenly divisible by 3. Note if using vectors, you will need an additional parameter to represent the number of numbers in the array.\u00a0So if the list was [0,4,2,6,9,8,3,12], the function would return 30 (0+6+9+3+12).<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>In this one, the code must look something like this:\u00a0<img decoding=\"async\" class=\"alignnone size-full wp-image-260\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/ab1d6992e29966b487c9aea6d6a56b21.jpg\" alt=\"Captura de pantalla 2016-04-07 a las 15.09.45\"   \/><br \/>\nIf you look well it is pretty simple. The find_threes function has 2 values inside, repeat and number[] (This will use an <\/p>\n<div class=\"post-limited-image\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/b70153870178fad65c0011feed114480.jpg\" \/><\/div>\n<div class=\"post-limited-image\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/c2f2454e8821c7ab3b219567eaf0f6ea.jpg#038;blog=105485076&#038;%23038;post=240&#038;%23038;subd=antonioangelm&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/div>\n<p><!--more-->. The repeat will be the amount of numbers that you will give, and number[] will be the actual numbers.<br \/>\ns will be the sum, and cond will be the condition for each number, that needs to be zero to be in the sum. Only if they are\u00a0evenly divisible by 3.<\/p>\n<p>The for loops, one is for the condition and the sum of all the numbers that are divisible by 3; the second one is to save the values of the numbers into number[i], wich in the int main function will be n = number, n[i].<\/p>\n<p>And thats it.<br \/>\nMy friend Carlos Ruvalcaba helped me on the second part, so I am giving him some credit for this work.<\/p>\n<p>Here&#8217;s the <a href=\"https:\/\/github.com\/antonioangelm24\/TC101\/blob\/master\/Quiz%205_a\" >GitHub Code for the part 2.<\/a><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/antonioangelm.wordpress.com\/240\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/b70153870178fad65c0011feed114480.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/04\/c2f2454e8821c7ab3b219567eaf0f6ea.jpg#038;blog=105485076&#038;%23038;post=240&#038;%23038;subd=antonioangelm&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are the instructions: Create a function called is_palindrome which receives a string as a parameter and\u00a0returns true if that string is a palindrome, false otherwise. Remember that a palindrome\u00a0is a word that is the same forward or backward. For full points your function must ignore\u00a0case and must work with any character (not just letters).\u00a0So &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/04\/quiz-5-14\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Quiz 5<\/span><\/a><\/p>\n","protected":false},"author":53,"featured_media":35489,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[209,31],"class_list":["post-35465","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-quiz5","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/35465","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\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=35465"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/35465\/revisions"}],"predecessor-version":[{"id":35496,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/35465\/revisions\/35496"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/35489"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=35465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=35465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=35465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}