I need to be able to make a random number between 60 and 100 but my code is not cutting it. I think this should work, but I've gotten numbers a low as 41. If I move either of the numbers up, my random number goes up to like 120. Can someone help me get the correct numbers to put in the code?
#include <iostream>
#include<ctime>
usingnamespace std;
int main()
{
int Temp=0;
srand (time(NULL));
for(int i = 0; i<=10; i++)
{
Temp = rand()%60+40;
cout<<Temp<<endl;
}
system("pause");
return 0;
}
Also, Could someone give me a crash course on how this format of random numbers works? I looked it up on this site but they use a different format than me and I like mine better. So is the number after the percent the minimum value?