{"id":76,"date":"2013-06-01T00:02:22","date_gmt":"2013-06-01T08:02:22","guid":{"rendered":"http:\/\/c-for-dummies.com\/blog\/?p=76"},"modified":"2013-06-01T10:30:52","modified_gmt":"2013-06-01T18:30:52","slug":"1st-2nd-and-3th","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=76","title":{"rendered":"1st, 2nd, and 3th"},"content":{"rendered":"<p>For your June exercise, you need to concoct code that properly generates an ordinal number. Write a function that returns a string &#8220;st&#8221; &#8220;nd&#8221; &#8220;rd&#8221; or &#8220;th&#8221; that&#8217;s tacked on to any integer value from 1 through what-have-you.<br \/>\n<!--more--><br \/>\nTo test the function, write a loop that displays values from 1 through 100. The output would look something like this:<\/p>\n<p><code>...<br \/>\n21st<br \/>\n22nd<br \/>\n23rd<br \/>\n24th<br \/>\n25th<br \/>\n...<\/code><\/p>\n<p><strong>HINT:<\/strong> The first step to devising a solution is to know the rules about making numbers into ordinals in English. Generally speaking:<\/p>\n<ul>\n<li>Any value ending in 1 becomes 1st.<\/li>\n<li>Any value ending in 2 becomes 2nd.<\/li>\n<li>Any value ending in 3 becomes 3rd.<\/li>\n<li>Values ending in 4 through 0 end with a <em>th<\/em>.<\/li>\n<li>Values between 11 and 19 all end in <em>th<\/em>.<\/li>\n<\/ul>\n<p>Please attempt the exercise before you peek at my solution. Remember that my solution is merely one way of solving the problem.<\/p>\n<p><a href=\"http:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2013\/06\/06exercise.c\">Exercise Solution<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>See whether you can code a function that attaches the proper ordinal string to integer values. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=76\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":7,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":106,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions\/106"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}