jaybeau21

Review 17

Apr 7th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /*Unit 5 Packet 6 Review 17
  2. Jarod Beaumariage 4-4-2017*/
  3.  
  4. #include <iostream>
  5. #include <string>
  6. #include <windows.h>
  7. #include <iomanip>
  8. #include "MyConsole.h"
  9.  
  10. using namespace std;
  11.  
  12. void RandomLoHi(int lo, int hi, int &randInt)
  13. {
  14. randInt = rand() % (hi + 1 - lo) + lo;
  15. }
  16.  
  17. int main()
  18. {
  19. int lo, hi, random;
  20.  
  21. //Get user input
  22. cout << "Enter the highest number of your range: ";
  23. cin >> hi;
  24. ClearScreen();
  25. cout << "Enter the lowest number of your range: ";
  26. cin >> lo;
  27. ClearScreen();
  28.  
  29. //Call FindLoHi
  30. RandomLoHi(lo, hi, random);
  31.  
  32. //Output random number
  33. cout << "A random number in this range is " << random;
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment