By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,326 Members | 2,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,326 IT Pros & Developers. It's quick & easy.

im using while while loop to create 10 random numbers, and display on screen. Each n

P: 2
so far this is all i have im a begginer to coding and cant figure out how to create a random number
Expand|Select|Wrap|Line Numbers
  1. {
  2.     int i = 100;
  3.     while (i <= 199)
  4.     {
  5.         cout << "your number is 100-199\n";
  6.         cout << " i = " << i << endl;
  7.         i++;
  8.  
  9.     }
  10.  
  11.     system("pause");
  12. }
Nov 5 '15 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
There is a library function named rand(). You call it and it returns a random number as an int.

You need to #include <stdlib.h> in order to use it.
Nov 6 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.