For this weekly WSQ which is #10 We will be using  arrays in order to create a program that asks the user for 10 numbers  (floating point). Store those numbers in a list. Show to the user the total, average and standard deviation of those numbers.

So the code will look like this:

#include <iostream>
#include <math.h>
using namespace std;

float aver(float x){
  return (x/10);
}

int main (){
	float array1[10];
	float suma=0;
	float square=0, deviation;
	for (int i=0; i<10; i++)
	{
		cout<<"Please introduce the value number "<<(i+1)<<" : ";
		cin>>array1[i];
	}

	for (int i=0; i<10; i++)
	{
	suma+=array1[i];
	square+=(array1[i])*(array1[i]);
	}
	deviation=sqrt(square/10);

  cout<<""<<endl;
	cout<<"The addition is equals to: "<<suma<<endl;
	cout<<"The average of the numbers you introduce is: "<<aver(suma)<<endl;
	cout<<"The standard deviation of the numbers you introduce is: "<<deviation<<endl;

return 0;
}

And the execution will be as the following:
Lists execution

Once more, thank you for your attention and as always I will be leaving the codes on my GitHub account.

Remember to keep practicing!

-The Admin

CC BY 4.0 Lists! by esaupreciado is licensed under a Creative Commons Attribution 4.0 International License.