Hi.. I have another array exercise and it has this debug error again but this time it doesn't give the sum output.
The code is as follows:
Any ideas will be great! Thanks..Code://array initialization and sum output based on user input #include <iostream> using namespace std; int main () { int ar[7] = {ar[0], ar[1], ar[2], ar[3], ar[4], ar[5], ar[6]}; int sumArray = 0; int i = 0; cout << "Enter an integer for value 1: "; cin >> ar[0]; cout << "Enter an integer for value 2: "; cin >> ar[1]; cout << "Enter an integer for value 3: "; cin >> ar[2]; cout << "Enter an integer for value 4: "; cin >> ar[3]; cout << "Enter an integer for value 5: "; cin >> ar[4]; cout << "Enter an integer for value 6: "; cin >> ar[5]; cout << "Enter an integer for value 7: "; cin >> ar[6]; for (i = 0; i < 7; i++); { sumArray += ar[i]; } cout << endl; cout << "Total is: "; cout << sumArray << endl; }