Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Unit 5 Packet 6 Review 17
- Jarod Beaumariage 4-4-2017*/
- #include <iostream>
- #include <string>
- #include <windows.h>
- #include <iomanip>
- #include "MyConsole.h"
- using namespace std;
- void RandomLoHi(int lo, int hi, int &randInt)
- {
- randInt = rand() % (hi + 1 - lo) + lo;
- }
- int main()
- {
- int lo, hi, random;
- //Get user input
- cout << "Enter the highest number of your range: ";
- cin >> hi;
- ClearScreen();
- cout << "Enter the lowest number of your range: ";
- cin >> lo;
- ClearScreen();
- //Call FindLoHi
- RandomLoHi(lo, hi, random);
- //Output random number
- cout << "A random number in this range is " << random;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment