+ 1

What i want to do if i havd to generate random number between 20-100?

27th Jun 2017, 2:01 PM
radhalakshmi arjun
3 ответов
+ 16
Umm something like... #include <iostream> #include<cstdlib> #include<ctime> using namespace std; int main() { int x; srand(time(0)); x=(1+(rand()%100)); if(x<20) x=x+20; cout<<x; return 0; }
27th Jun 2017, 2:11 PM
Frost
Frost - avatar
27th Jun 2017, 2:10 PM
aklex
aklex - avatar
+ 4
v = rand() % 100 + 20;
27th Jun 2017, 2:11 PM
Maart
Maart - avatar