I need numbers in between the specific interval.
# include<iostream>
# include<cstdlib>
# include<ctime>
using namespace std;
int main()
{
srand(time(0));
for (int x = 1; x<=10; x++)
{
cout<< 15+ (rand()% 20) <<endl;
}
}
I expected the output between 15 and 20 like [15,20], but i always get output > or <, not in the exact interval.
Aucun commentaire:
Enregistrer un commentaire