[Solved] c++ adding one by one to array till full


In bool StatsList::NewGrade(ListType grade) there are a couple problems.

  1. 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 like listindex and making it a member variable.
  2. There is no return true. The logical place to put it appears to be at the end inside the if (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