I have this code here
#include <iostream>
using namespace std;
int checkLevel(){
int exp[101]={0,1,6,21,51,100,172,274,409,583,800,1064,1382,1757,2195,2700,3276,3930,4665,5487,6400,7408,8518,9733,11059,12500,14060,15746,17561,19511,21600,23832,26214,28749,31443,
34300,37324,40522,43897,47455,51200,55136,59270,63605,68147,72900,77868,83058,88473,94119,100000,106121,112486,119102,125971,133100,140493,148154,156090,164303,172800,181585,190662,200038,
209715,219700,229997,240610,251546,262807,274400,286329,298598,311214,324179,337500,351181,365226,379642,394431,409600,425153,441094,457430,474163,491300,508845,526802,545178,563975,583200,
602857,622950,643486,664467,685900,707789,730138,752954,776239,800000};
int level = 1;
int nextLevel = 2;
int PokemonExp = 0;
int input;
int num = 1;
while (num == 1){
cout << "Enter exp amount: ";
cin >> input;
PokemonExp = PokemonExp+input;
cout << "\nCurrent level is: " << level << endl;
cout << "\nTreeko gained "<< input << " exp!\n" << endl;
cout << "Exp is: " << PokemonExp << endl;
while(PokemonExp >= exp[nextLevel] && PokemonExp <= exp[101]){
level++;
cout << "Treeko leveled up to level: " << level << endl;
cout << "\n";
nextLevel++;
if(level < 100){
cout << "Current level is: " << level << endl;
cout << "\nNext level is: " << nextLevel << endl;
cout << "\nCurrent EXP amount is: " << PokemonExp << endl;
cout << "\nEXP to next level is: " << exp[nextLevel]-PokemonExp << endl;
cout << "\n" << endl;
}else{
cout << "Current level is: " << level << endl;
cout << "\nNext level is: 100" << endl;
cout << "\nCurrent EXP amount is: " << PokemonExp << endl;
cout << "\nEXP to next level is: 0" << endl;
cout << "\n" << endl;
}
}
}
}
//TODO: Make a check for max EXP (800,000)
(in file ExpTable.h)
The while(num == 1) loop, is for testing purposes.
However my problem is with the while loop nested inside that loop. When I enter EXP as 10 (more than enough to level the Pokemon to 2) it just doesn't run it.
This problem only happens in XCode on Mac OSX. Works fine and as intended on Dev C++ on my Vista computer. (Mac comp is school one =/)
Any ideas?