{"id":4223,"date":"2020-07-01T00:01:27","date_gmt":"2020-07-01T07:01:27","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=4223"},"modified":"2024-03-27T16:17:55","modified_gmt":"2024-03-27T23:17:55","slug":"nested-processing","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=4223","title":{"rendered":"Nested Processing"},"content":{"rendered":"<p>After a few intermediate to advanced Exercises, I decided to try something that&#8217;s a little easier this month. Still, even if you&#8217;re a pro, it helps to pull back and try something basic just to see what you can do with it.<br \/>\n<!--more--><br \/>\nFor this month&#8217;s Exercise, the challenge is to output a primitive, text mode bar graph. The data is held in an array:<\/p>\n<p><code>int v[5] = { 5, 3, 8, 7, 2 };<\/code><\/p>\n<p>Your job is to write the code that outputs a five line bar graph that looks something like this:<\/p>\n<p><code>1: ***** (5)<br \/>\n2: *** (3)<br \/>\n3: ******** (8)<br \/>\n4: ******* (7)<br \/>\n5: ** (2)<\/code><\/p>\n<p>That&#8217;s it, though multiple methods exist to solve this problem.<\/p>\n<p>I tried to write a version without using nested loops, but that just didn&#8217;t work. And, yes, calling a function with a second loop is still a nested loop. Therefore, somehow you&#8217;ll probably devise a solution with a nested loop. To not do so would be remarkable, so be sure to share such a solution.<\/p>\n<p>Please try this Exercise on your own before you check out <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=4238\">what I&#8217;ve done<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time to back off a tad for this month&#8217;s Exercise and try something more basic. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=4223\">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-4223","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\/4223","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=4223"}],"version-history":[{"count":4,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4223\/revisions"}],"predecessor-version":[{"id":6336,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4223\/revisions\/6336"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}