Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. //Xinzhu Men
  2. //ID:0492273
  3. //Date: 2/25/2017
  4. //Journals 3B
  5. //random numbers
  6.  
  7.  
  8.  
  9. #include <iostream>
  10.  
  11. #include <ctime>
  12.  
  13. using namespace std;
  14.  
  15. int randrange(int x, int y);
  16.  
  17. int main()
  18. {
  19.     int min, max;
  20.     srand((unsigned int) time(0));
  21.  
  22.     cout << "Enter your min value " << endl;
  23.     cin >> min;
  24.  
  25.     cout << "Enter your maxvalue " << endl;
  26.     cin >> max;
  27.  
  28.     for (int j = 0; j < 10; j++)
  29.     {
  30.     for(int i = 0; i < 10 ; i++)
  31.  
  32.     {
  33.         cout << randrange (min,max);
  34.  
  35.         cout << (rand() % (1 + max - min) + min)<< "\t ";
  36.  
  37.     }
  38.  
  39.     cout << endl;
  40.  
  41.     }
  42.  
  43.     return 0;
  44.  
  45. }
  46.  
  47.  
  48.     int randrange(int x, int y)
  49. {
  50.  
  51.         cout << (rand() % (1 + x - y) + y)<< "\t ";
  52.  
  53.     return 0;
  54.  
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement