Created
January 28, 2018 09:28
-
-
Save ksjgh/9862286fbae4f2dd94b90ed8ddba782d to your computer and use it in GitHub Desktop.
random number generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <time.h> //added for the random number generator seed | |
| #include <cstdlib>//added to use the rand function | |
| int main() | |
| { | |
| int target; | |
| std::string userString; | |
| int guess = -1; | |
| srand(time(NULL)); //set the seed for the random number generator | |
| target = rand() %100 + 1; //generate the 'random' number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment