cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
A number between 10 to 100 randomly
A number between 10 to 100 randomly
Mar 4, 2012 at 3:17pm UTC
Ken777
(37)
#include <iostream>
#include <ctime>
using namespace std;
int main ()
{
int i,j;
srand ( (unsigned)time( NULL ) );
//Display 1 random number
for ( i = 0;i < 1;i++)
{
j= rand() %100;
cout << j << endl;
}
system ("pause");
return 0;
}
Mar 4, 2012 at 3:20pm UTC
hanst99
(2869)
No.
Mar 4, 2012 at 3:26pm UTC
Ken777
(37)
No to what
Mar 4, 2012 at 3:35pm UTC
hanst99
(2869)
That's not what it does, obviously.
Mar 4, 2012 at 3:40pm UTC
Ken777
(37)
No it works but still getting numbers below 10 thats my problem
Mar 4, 2012 at 3:54pm UTC
BlackSheep
(424)
j = rand()%90 + 10;
Mar 4, 2012 at 4:02pm UTC
Ken777
(37)
Thanks for that ave working perfect now.
Topic archived. No new replies allowed.