Hi guys, I'm writing my first intro programming midterm tomorrow, and need a little help with arrays. This is my first time programming so I'm very new.
I want to create a program that stores 10 numbers (from input) into an array, and display the sum of those numbers. However, when I compile the code that I make, no matter what my input values are, I always end up with the answer 5373728.
Is there any specific reason for this? From what I can tell the code looks good, mabye its just a problem with my compiler? Any help before my midterm would be much appreciated. Thanks :)
using namespace std;
#include <cmath>//you don't need this in this case.
int sum=0, a;
int i = 0;
for (i; i<10; i++)
cin >> a[i];
sum += a[i];