{"id":33603,"date":"2016-02-27T15:16:55","date_gmt":"2016-02-27T21:16:55","guid":{"rendered":"http:\/\/orlando2120.wordpress.com\/?p=289"},"modified":"2016-02-27T15:34:08","modified_gmt":"2016-02-27T21:34:08","slug":"%c2%a7%e2%80%a1%e2%80%a1%e2%80%a1quiz4%e2%80%a1%e2%80%a1%e2%80%a1%c2%a7","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/%c2%a7%e2%80%a1%e2%80%a1%e2%80%a1quiz4%e2%80%a1%e2%80%a1%e2%80%a1%c2%a7\/","title":{"rendered":"\u00a7\u2021\u2021\u2021Quiz4\u2021\u2021\u2021\u00a7"},"content":{"rendered":"<p><a href=\"https:\/\/www.flickr.com\/photos\/135393034@N06\/21690222144\/\" >Photograph credit<\/a><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-293\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/a344202fd05478d71c41a0236cf68f72.jpg\" alt=\"zxsq3\"   \/><\/p>\n<p>Hey guys, IT WORKS, but it isn&#8217;t perfect. I had a problem and I got around it but it isn&#8217;t fixed. The problem I had was this:\u00a0<strong>Basically the user inputs a number like 0.00001 and my loop is supposed to multiply it by 10 until it reaches 1. Once that value reaches 1 then the loop is supposed to stop and tell me how many times the loop was run. The problem is that the value NEVER equals 1. I don&#8217;t know why that happens.\u00a0<\/strong>If you guys know how to fix this, please help. Here is my code: with the loop that has the problem, the orginal and the one that prints out each value(so you can see what is going on with e):<span id=\"more-289\"><\/span><\/p>\n<p><a href=\"https:\/\/github.com\/OrlandoLara21\/Coding-on-C-\/blob\/Engineer\/LoopFunction\" >LoopFunction.cpp<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/OrlandoLara21\/Coding-on-C-\/blob\/Engineer\/euler_calc\" >euler_calc.cpp<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/OrlandoLara21\/Coding-on-C-\/blob\/Engineer\/Quiz4\" >Quiz4.cpp<\/a><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-302\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/542aa5e7e000f53b28f2387ff70d3980.jpg\" alt=\"Screen Shot 2016-02-27 at 2.53.27 PM\"   \/><\/p>\n<p>This function tells me how many significant figures will be used to print out euler&#8217;s number.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-308\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/077ec16d820aa6360bc5744936d4ee14.jpg\" alt=\"Screen Shot 2016-02-27 at 3.08.35 PM.png\"   \/>\u00a0This function simply gets the factorial of a number.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-312\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/1cbdcaa31c64c8cfa3a21a8f25453f3d.jpg\" alt=\"Screen Shot 2016-02-27 at 3.10.22 PM.png\"   \/><\/p>\n<p>With this function I calculate the value e, in my loop you will notice that my conditional is pre&gt;x. well x is the number given by the user to know how many significant figures to use for e. pre is the difference between the previuos and the actual value of e. so if x=0.0001 then the loop will continue until pre(the difference of the previous and actual value of e) is less than 0.0001.<\/p>\n<p>You will probably notice that I have a command that says set precision(26). This just makes the program print out the number with that many significant figures. \u00a0I look <a href=\"http:\/\/www.cplusplus.com\/reference\/iomanip\/setprecision\/\" >here<\/a><br \/>\nfor that command.<\/p>\n<div class=\"jetpack-video-wrapper\"><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text\/html' width='700' height='424' src='https:\/\/www.youtube.com\/embed\/jiY0OKQIpPk?version=3&#038;rel=1&#038;%23038;fs=1&#038;%23038;autohide=2&#038;%23038;showsearch=0&#038;%23038;showinfo=1&#038;%23038;iv_load_policy=1&#038;%23038;wmode=transparent' frameborder='0' allowfullscreen='true'><\/iframe><\/span><\/div>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/orlando2120.wordpress.com\/289\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/b51e236570e2742a63c662f0b03caad6.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/6cfe7610ad539ec165762759afd30a8e.jpg#038;blog=105225774&#038;%23038;post=289&#038;%23038;subd=orlando2120&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Photograph credit Hey guys, IT WORKS, but it isn&#8217;t perfect. I had a problem and I got around it but it isn&#8217;t fixed. The problem I had was this:\u00a0Basically the user inputs a number like 0.00001 and my loop is supposed to multiply it by 10 until it reaches 1. Once that value reaches 1 &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/%c2%a7%e2%80%a1%e2%80%a1%e2%80%a1quiz4%e2%80%a1%e2%80%a1%e2%80%a1%c2%a7\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u00a7\u2021\u2021\u2021Quiz4\u2021\u2021\u2021\u00a7<\/span><\/a><\/p>\n","protected":false},"author":39,"featured_media":33605,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[159,160,62,200],"class_list":["post-33603","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-lara","tag-sciencelife","tag-coding","tag-quiz4"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33603","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\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=33603"}],"version-history":[{"count":4,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33603\/revisions"}],"predecessor-version":[{"id":33616,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33603\/revisions\/33616"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/33605"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=33603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=33603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=33603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}