Advertisement
Guest User

Listing 13.9

a guest
Mar 5th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<cstdlib>
  4. #include<ctime>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. // Set random seed value
  11. srand(42);
  12.  
  13. // Need to use numbers larger than regular integers; use long long ints
  14. for (long long i=1; i<4294967400LL; i++)
  15. {
  16. int r = rand();
  17. if (1 <= i && i <= 10)
  18. cout << setw(10) << i << ":" << setw(6) << r << endl;
  19. else if (2147483645 <= i && i <= 2147483658)
  20. cout << setw(10) << i << ":" << setw(6) << r << endl;
  21. else if (4294967293LL <= i && i <= 4294967309LL)
  22. cout << setw(10) << i << ":" << setw(6) << r << endl;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement