+ 1
Can someone explain why this isin't working?
it gives a value bigger than the maximum one
1 Answer
+ 1
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main() {
int y,x,z;
cout<<"Input the minimal value"<<endl;
cin>>y;
cout<<"Input the maximum value"<<endl;
cin>>x;
srand(time(0));
cout<<y+(rand()%x);
return 0;
}