In bool StatsList::NewGrade(ListType grade)
there are a couple problems.
i
needs to persist from call to call otherwise it will always be set to 0 at the beginning of the function. I recommend giving it a more descriptive name likelistindex
and making it a member variable.- There is no
return true
. The logical place to put it appears to be at the end inside theif (full)
body.
A word on full
. full
is true if List
is not full. The untruth in this naming will only mislead people and result in errors injected by people maintaining the code in the future. I recommend changing the name or changing the way it is used. Changing the name seems more logical to me.
2
solved c++ adding one by one to array till full