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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Carrera4212
    New Member
    • Nov 2015
    • 2

    #1

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

    so far this is all i have im a begginer to coding and cant figure out how to create a random number
    Code:
    {
    	int i = 100;
    	while (i <= 199)
    	{
    		cout << "your number is 100-199\n";
    		cout << " i = " << i << endl;
    		i++;
    		
    	}
    
    	system("pause");
    }
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    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.

    Comment

    Working...