Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i m doing my projects and the double pointer issue keep struggle me.my professor

ID: 440909 • Letter: I

Question

i m doing my projects and the double pointer issue keep struggle me.my professor ask us to avoid using array notation. however, he didn't give us a directly example about how to use double pointer so that i m confused about it. here is my project so far. #include #include using namespace std; bool CheckValid(int rows); void Print(char ** seat, int rows); void GetSeat( int& row, char& column); void Ordering(char **seat, int& row, char & column); int main() { int rows,row; char answer, column; bool Valid; char ** seat; do { cout<<"seat:"<<seat<<endl; cout<<"How many rowss this plane has?(1-15)"<<endl; cin>>rows; Valid=CheckValid(rows); while(!Valid) { cout<<"Invalid rows number, please enter another one:"<<endl; cin>>rows; Valid=CheckValid(rows); } if(Valid) { seat= new char*[rows]; char * col= *seat; col=new char[4]; strcpy(col, "ABCD"); col++; cout<<"col"<<*col<<endl; /*Print(seat, rows); GetSeat(row,column); Ordering(seat, row ,column); Print(seat, rows);*/ } delete []seat; cout<<"Do you want to repeat? (Y/N))"<<endl; cin>>answer; }while(toupper(answer)!='N'); system("pause"); return 0; } bool CheckValid(int rows) { if(rows<1||rows>15) { return false; } else return true; } void GetSeat( int& row, char& column) { cout << "Enter the seat you want to sit: " << endl; cin >> row; cin >> column; column = toupper(column); } void Print(char ** seat, int rows) { for(int i=0;i<4;j++) { //cout<<"seat i "<<i<<" j "<<j<<endl; cout<<'['<<seat[i][j]<<']'; } cout<<endl; } } void Ordering(char **seat, int& row, char & column) { for(int i=0;i<<"seat i "<<i<<" j "<<j<<endl; seat[ row-1 ][column-65]= 'X'; } } } i don't know how to fix it. i tried create a char * col pointer, and let it equal to * seat and then change all array notation to col, but it doesn't work. any help is appreciated.

Explanation / Answer

You simply forgot to declare the function prototypes before main(). If you write your functions after main(), you have to delcare the prototypes so that the code in main() can know that it exists.Just copy the function header of each function and paste it before main with a semicolon, for example//...