### Help on Arrays

Well here's what I got. I need help to be able to use negative numbers and also it keeps giving me the average and sum for all 10 numbers but I want it to do that for all the numbers combined.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152`` ``````#include #include using namespace std; const int SIZE = 10; int main() { double myArray[SIZE]; for (int i=0; i<10; i++) { cout << "Enter a valid number: " << endl; cin >> myArray[i]; } for (unsigned int i=0;i<10; i++) { int sum = 0; sum += myArray[i]; double avg = sum/10; cout<<"The sum is: "<= largest) largest = myArray[i]; cout<<"The smallest is: "<
If I have correctly understood you need the following

 ``12345678910`` `````` double sum = 0; for (unsigned int i=0;i<10; i++) { sum += myArray[i]; } double avg = sum/10; cout<<"The sum is: "<

That helped just a little. But there's something wrong with the smallest/largest part and it keeps giving me the smallest and largest for every single number
Look at how vlad did change your average calculation and reporting. What did he do there? Same solution applies to the min/max.
Topic archived. No new replies allowed.