{"id":33572,"date":"2016-02-25T21:50:32","date_gmt":"2016-02-26T03:50:32","guid":{"rendered":"http:\/\/netosanchezb.wordpress.com\/?p=357"},"modified":"2016-02-25T22:43:25","modified_gmt":"2016-02-26T04:43:25","slug":"standard-deviation-calculator","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/standard-deviation-calculator\/","title":{"rendered":"Standard deviation calculator"},"content":{"rendered":"<p><strong>THIS BLOGPOST IS \u00a0NOT DONE YET, BUT STILL YOU CAN ALREADY TAKE A LOOK AT THE CODE, WHICH IS AT THE END.\u00a0<\/strong>For the task number ten of the semester, we were asked to create program\u00a0that asks the user for 10 numbers. We were required to store those numbers in a list and to show the user the total, average and standard deviation of those numbers.<\/p>\n<p>The easiest way to this was to create an array for those numbers. An array is just a group of numbers saved by the computer. You can acces any of those numbers\u00a0<img decoding=\"async\" class=\" size-full wp-image-369 aligncenter\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/22d2139440cbf240d41194c336e61351.jpg\" alt=\"WSQ10_functions1\"   \/><img decoding=\"async\" class=\" size-full wp-image-368 aligncenter\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/114125e140e7b5cee5a324b7741c5b24.jpg\" alt=\"WSQ10_STDFfunctions\"   \/><img decoding=\"async\" class=\" size-full wp-image-367 aligncenter\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/ad58900afb99473406cf3fa3e8a9fdcf.jpg\" alt=\"WSQ10_main\"   \/><\/p>\n<p><strong>#include &lt;iostream&gt;<\/strong><br \/>\n<strong>#include &lt;cmath&gt;<\/strong><\/p>\n<p><strong>using namespace std;<\/strong><\/p>\n<p><strong>int y;<\/strong><br \/>\n<strong>char answer;<\/strong><\/p>\n<p><strong>float SumaTotal(float arre [], int numNumeros){<\/strong><\/p>\n<p><strong>float sum = 0;<\/strong><\/p>\n<p><strong>for (int i = 0; i &lt; numNumeros; i++){<\/strong><\/p>\n<p><strong>sum += arre[i];<\/strong><br \/>\n<strong> }<\/strong><br \/>\n<strong> return sum;<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>float Average (float arra[], int numas){<\/strong><\/p>\n<p><strong>float aver, suma = 0;<\/strong><\/p>\n<p><strong>for (int c = 0; c &lt; numas; c++){<\/strong><\/p>\n<p><strong>suma = suma + arra[c];<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>aver = suma \/ numas;<\/strong><\/p>\n<p><strong>return aver;<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>float STDF (float arre[], int numdenum){<\/strong><\/p>\n<p><strong>float aver, sumaII, sumaIII = 0,sumaI = 0;<\/strong><br \/>\n<strong> double stdfi;<\/strong><br \/>\n<strong> for (int c = 0; c &lt; numdenum; c++){<\/strong><\/p>\n<p><strong>sumaI += arre[c];<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>aver = sumaI \/ numdenum;<\/strong><\/p>\n<p><strong>for (int i = 0; i &lt; numdenum; i++){<\/strong><\/p>\n<p><strong>sumaII = arre[i] &#8211; aver;<\/strong><br \/>\n<strong> sumaIII += pow((sumaII), 2);<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>stdfi = sqrt((sumaIII \/ numdenum ));<\/strong><\/p>\n<p><strong>return stdfi;<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>int main (){<\/strong><\/p>\n<p><strong>do{<\/strong><\/p>\n<p><strong>cout &lt;&lt; &#8220;Type the number of numbers that you want to have: &#8220;;<\/strong><br \/>\n<strong> cin &gt;&gt; y;<\/strong><\/p>\n<p><strong>const int numNumbers = y;<\/strong><\/p>\n<p><strong>float x [numNumbers];<\/strong><\/p>\n<p><strong>for (int i = 0; i &lt; numNumbers; i = i + 1){<\/strong><br \/>\n<strong> cout &lt;&lt; &#8220;Provide the number &#8221; &lt;&lt; i + 1 &lt;&lt; &#8221; number: &#8220;;<\/strong><br \/>\n<strong> cin &gt;&gt; x [i];<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong> cout &lt;&lt; &#8220;The total of your numbers is: <\/p>\n<div class=\"post-limited-image\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/2747ba3efebe9dd1403d18ae1df8b2ac.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\/02\/42393c9a61590be62aecabfda117d80f.jpg#038;blog=105214593&#038;%23038;post=357&#038;%23038;subd=netosanchezb&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/div>\n<p><!--more--> &lt;&lt; SumaTotal(x, numNumbers) &lt;&lt; endl;<\/strong><br \/>\n<strong> cout &lt;&lt; &#8220;The average of your numbers is: &#8221; &lt;&lt; Average(x, numNumbers) &lt;&lt; endl;<\/strong><br \/>\n<strong> cout &lt;&lt; &#8220;The Standard deviation of your numbers is: &#8221; &lt;&lt; STDF(x, numNumbers) &lt;&lt; endl;<\/strong><\/p>\n<p><strong>cout &lt;&lt; &#8220;Do you want to try again? Type y if you do: &#8220;;<\/strong><br \/>\n<strong> cin &gt;&gt; answer;<\/strong><\/p>\n<p><strong>} while (answer == &#8216;y&#8217;);<\/strong><\/p>\n<p><strong>return 0;<\/strong><br \/>\n<strong>}<\/strong><\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/netosanchezb.wordpress.com\/357\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/2747ba3efebe9dd1403d18ae1df8b2ac.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/42393c9a61590be62aecabfda117d80f.jpg#038;blog=105214593&#038;%23038;post=357&#038;%23038;subd=netosanchezb&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>THIS BLOGPOST IS \u00a0NOT DONE YET, BUT STILL YOU CAN ALREADY TAKE A LOOK AT THE CODE, WHICH IS AT THE END.\u00a0For the task number ten of the semester, we were asked to create program\u00a0that asks the user for 10 numbers. We were required to store those numbers in a list and to show the &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/standard-deviation-calculator\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Standard deviation calculator<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":33574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[69,68,90,193],"class_list":["post-33572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-netoelgrande","tag-sincategoria","tag-underconstruction","tag-wsq10"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33572","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=33572"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33572\/revisions"}],"predecessor-version":[{"id":33582,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/33572\/revisions\/33582"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/33574"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=33572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=33572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=33572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}