I am entireley new to coding, and am coding a program to simulate catching pokemon. I have a bunch of random numbers being generated during it, but the one that randomizes which pokemon (In int main()) is not randomizing, its only producing "1". Forgive my chaotic coding.
This is the int main
int main(){
srand(time(0));
int Pokemon = rand() % 3 + 1;
if (Pokemon = 1)
{
Pokemon1();
}
else if (Pokemon = 2)
{
Pokemon2();
}
else
{
Pokemon3();
}
return 0;
}
It is calling the other functions. The same thing is happening when randomizing the Pokeball, it allways chooses Ultra Ball
srand(time(NULL));
int BallTypeRand = rand() % 100 + 1;
if (1 < BallTypeRand < 21)
{
BallType = 1;
BallName = "Ultra Ball";
BallCatchRate = 63;
}
else if (21 < BallTypeRand < 51)
{
BallType = 2;
BallName = "Great Ball";
BallCatchRate = 41;
}
else
{
BallType = 3;
BallName = "Poke Ball";
BallCatchRate = 28;
}
Anyone got any ideas?
Headers are
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;