Hi I think this is my first post, so here it goes: Overview:
This program declares global bidimensional array of 30 rows and 5 columns (not counting 0 in the rows) of floating type to save information of students, table is as follows:
ID Partial1 Partial2 Partial3 Partial4 Average
ID: em..I
Partial N: Students grade of a evaluation.
Average: well students final grade.
the grade can't be higher than 10.
Problem:
Ok so my problem is that when I start inputing data everything goes well until we input more than 1 student, when I enter the second ID it is saved but the second student's ID overwrites the last student's average, having the ID duplicated and the las average erased, and i can't figure out why is this happening, I've looked at the code for hours, so any help is really appreciated, by the way I'm relatively new to c++.
Is your array declared as 5 columns or as 6? It makes a difference in the indexing you use.
Are you using the row index as the student ID? I don't see input for IDs.
Remember that the maximum index you can (safely) use is one less than the size of the array dimension. So, if your array is [30][5], your maximum index is [29][4]. By putting the average in column index [5], you are probably overwriting the first position of the next row.
het thanks for ypur answer, redimensioning tn columns to 6 solved the issue, Just on last question, why does it overwrite?, I mean why is it safe to use cols-1 as the last index.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.