hey, im new at this, and i cant figure out how to make and use functions.. ive done the tutorial and ive been trying for several hours now, help would be very appreciated
it says here when i try to compile it,Code:#include <iostream> using namespace std; void display(void); int main() { int x, y; int loc[3][3]; loc[1][1] =1; loc[2][1]= 1; loc[3][1] = 1; loc[1][2] =1; loc[2][2]= 1; loc[3][2] = 1; loc[1][3] =1; loc[2][3]= 1; loc[3][3] = 1; while (1){ cout<<"enter x then y value for player X\n"; cin>>x>>y; cin.ignore(); if (loc[x][y] == 1){loc[x][y] = 8;}; ; cin.get(); cout<<"enter x then y value for player O\n"; cin>>x>>y; cin.ignore(); if (loc[x][y] == 1){loc[x][y] = 0;}; display(); cin.get(); } void display(void)// this is line 39 { cout<<"["<<loc[1][1]<<"]"<<"["<<loc[2][1]<<"]"<<"["<<loc[3][1]<<"]"<<"\n"<<"["<<loc[1][2]<<"]"<<"["<<loc[2][2]<<"]"<<"["<<loc[3][2]<<"]"<<"\n"<<"["<<loc[1][3]<<"]"<<"["<<loc[2][3]<<"]"<<"["<<loc[3][3]<<"]"; } }
"line 39 - expected primary-expression before "void" ". what have i done wrong?
Thanks in advance =D