Lists – WSQ07

--Originally published at Programming in C++

For this program we had to ask the user for 10 numbers and saved the in a list. In this case I used arrays, but it can also be done with vectors. And then show to the user the total, average and standard deviation of those numbers.


Here are the 3 functions of the program (one for total, one for average, and one for standard deviation). The only new thing is putting arrays on them. Which is actually simple. You put the name of the array and then the size of it .


Now we have the main part:

wsq07m Here we have our array and its size. The size of the array is put between “[ ]”. Then there is a for for inserting the values. When talking about arrays we have to remember that it does not start counting in 1, it starts with 0, so that’s why our i starts there.


WSQ07 with Vectors

--Originally published at Valeria CT

In order to let user input values without declaring how many at the beginning, we can use vectors. However, I wasn’t able to perform any function by calling the values in a vector, so I also created an array with values from the vector and the it was easy to perform the function that I had writen previously on my other WSQ07s.

The link to my program is:

The resources I used are:



--Originally published at Valeria CT

For the WSQ07 I struggled a lot, so I decided to do two programs. The first would contain the basic requirements (10 user input values), and the second with the unlimited amount of user input values. What I did is I set the content of the array to 100 (which would technically be a limit), but I created an extra variable m that would only be modified if the user input for that value was something other than zero (won’t work if the user inputs 0). Everything is explained on my code:

Link to simple program:

Link to complex program: