void LevelUp() { static const int required_experience[] = { 0, 45, 95, 145, 210, 285, 380, 495, 610, 745, 99999999 }; //so whenever myexp reaches on of these integers, mylvl will go up by 1 while(myexp >= required_experience[mylvl]) ++mylvl; }