Basically this program just reads in a seating chart... Problem is I keep getting the error below... Im not sure what it means... My code seems correct?.. any help?
getting error
Main.cxxCode:main.cxx:8: error: variable-size type declared outside of any function main.cxx:8: error: variable-size type declared outside of any function main.cxx:10: error: variable-size type declared outside of any function main.cxx:11: error: variable-size type declared outside of any function main.cxx:33: error: variable-size type declared outside of any function main.cxx:40: error: variable-size type declared outside of any function
Code:#include <iostream> #include <fstream> using namespace std; int SIZE = 50; int num_mat,occupied, row, col; char m1[SIZE][SIZE]; void init_array(char array[][SIZE]); void display_array(char array[][SIZE]); int main() { init_array(m1); cin >> num_mat; cin >> occupied; while( !cin.eof() ) { cin >> row >> col; if(col=='\n') { occupied = row; display_array(m1); init_array(m1); } else m1[row][col] = 'X'; } return 0; } void init_array(char array[][SIZE]) { for(int i=0;i<SIZE;i++) { for(int j=0;j<SIZE;j++) array[i][j] = 'E'; } } void display_array(char array[][SIZE]) { for(int i=0;i<SIZE;i++) { for(int j=0;j<SIZE;j++) cout << array[i][j] << endl; } }
Thanks for any assistance guys.



LinkBack URL
About LinkBacks


