Now this is more confusing, we must combine loops, functions, mathematical formulas, a few of all the topics we´ve seen until now.
This code will be completely different to the ones you´ve done before(talking abt myself) well, here´s the code posted on GitHub.
To beggin, add the usual library <iostream> and instead of using the “using namespace std” just determinate which of the parameters of the library you´ll use. Also add the <cmath> library because you must use it for the StandartDeviation part of the code.
The program must ask the user for 10 float values, counting and saving them using a variable in function of another, numbers[i]. Repeting the “for” loop as many times as you give the instructions to the program in the NUMOFNUM variable.
Now what? Well the code must have 3 functions(3 + the main) one, which will calculate the total addition of the numbers the users gave. Secondly, the average of the 10 numbers the user typed and finally, the standart deviation(I´ll explain a lot better in the video bellow what is it and how to get it).
Create the function for the total and in it, the program must do a loop to be adding the next value and to not write everything like(number[1]+number[2]+number[3]…etc.
In the next one, the average, you don´t have to add the numbers again, just call the last function and just divide it for the number of values(in this case 10) and there you go, you got the average. As you can see in this part of the code you don´t need to create a new loop, using the result of the addition function is all.
Now the third part, the standart deviation(yeah i know, you don´t even know what the heck that means haha me either so i had
Continue reading “#WSQ10(Video)What the heck” →