{ if (xin == 1) { for (int n=0; n<HEIGHT; n++) for (int m=0; m<WIDTH; ++m) int sum=0; int sum += givenArray [HEIGHT] [WIDTH]; int average = sum/(HEIGHT*WIDTH); cout << "Average of the matrix is = " << average << endl; } system ("pause"); system ("CLR"); }

with the above simple function I continue to get an error saying

syntax error : missing ';' before '+='.

What does this mean exactly? To be honest the only reason I have

int sum=0;even in there is to try and fix this. Here is the whole code for reference but feel free to ignore most of it, it is very much so a work in progress.

#include <iostream> using namespace std; #include <iomanip> #define HEIGHT 5 #define WIDTH 4 int givenArray[5][4] = { { 34, 56, 79, 12 }, { 25, 37, 41, 18 }, { 59, 29, 38, 47 }, { 55, 11, 88, 34 }, { 45, 19, 34, 66 } }; int optionsMenu() { int xin; cout << "Please select an option" << endl; cout << "# 1 for average of matrix" << endl; cout << "# 2 to see the biggest number in the matrix" << endl; cout << "# 3 to see the smallest number in the matrix" << endl; cout << "# 4 to sort from largest to smallest" << endl; cout << "# 5 to sort from smallest to larges" << endl; cout << "# 6 to search for a number of your choice" << endl; cout << "# 7 to exit" << endl; cin >> xin; system ("CLR"); while (xin !=7) { if (xin == 1) { for (int n=0; n<HEIGHT; n++) for (int m=0; m<WIDTH; ++m) int sum=0; int sum += givenArray [HEIGHT] [WIDTH]; int average = sum/(HEIGHT*WIDTH); cout << "Average of the matrix is = " << average << endl; } system ("pause"); system ("CLR"); } else if (xin == 6) { for (int x=0; x<HEIGHT; x++) for (int y=0; y<WIDTH; y++) int = SearchVal cout << "Enter the number you would like to search for: " << endl; cin >> SearchVal; } system ("pause"); system ("CLR"); } } int main() { cout << "===============================================" << endl; cout << "WELCOME TO DATA PROCESSING CENTER" << endl; cout << "===============================================" << endl; optionsMenu(); }

I have tried to search for my error but it seems to be a code by code basis so I feel as if I have to post a topic now. I have tried to function with matrices using my professors notes but I can assure you that I will be reading up on the tutorials on this site this weekend.

I really just want to figure out what my error means! Thank's guys as always!