Monday, May 24, 2010

C++ maxtrix?

I have to create a gradebook that reads in any amount of students and what their grades are. The user can add more to the matrix if they need another column of grades. I am having a problem with my addGrades function and need help on what is worng and how I can fix it. Here is the function for my "Add Grades" function:





void AddGrades(vector%26lt;String%26gt; %26amp;name, TTTBoard %26amp;Board)


{








int Row = Board.numrows() - 1;


int Col = Board.numcols() - 1;





//Board.resize(Col,Row);


//for(int j=0;j%26lt;= Col;j++){





for(int i = 0; i %26lt; Row; i++){


cout%26lt;%26lt;"Please enter a grade for "%26lt;%26lt;name[i]%26lt;%26lt;" ";


cin%26gt;%26gt;Board[Row][i]; //j,i ?


Row++;


}//end for





//}//end for











}//end fun.





//Thanks.

C++ maxtrix?
void AddGrades(vector%26lt;String%26gt; %26amp;name, TTTBoard %26amp;Board)


{


int Row = Board.numrows() - 1;





for(int i = 0; i %26lt; Row; i++){


cout%26lt;%26lt;"Please enter a grade for "%26lt;%26lt;Name[i]%26lt;%26lt;" ";


cin%26gt;%26gt;Board[i];


}//end for





}//end fun.
Reply:This if for a console app fight? Hence the cout statements? If so, the cin statement only needs to be seperated by commas.... and why are you using { instead of ; for the endings of a few of your lines of code?


No comments:

Post a Comment