Skip to content

Here’s how it works: the program will generate a random int between 1 and 100. It will then prompt the player to enter a guess. After a guess is entered, the program will indicate whether the guess is too low or too high. If the guess is correct, the game will print a congratulatory message and exit.

Notifications You must be signed in to change notification settings

dolvin17/Guess_the_number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

guessing-game-program

This program uses common Rust concepts. The program will generate a random integer between 1 and 100, then prompt the player to enter a guess. After you enter an assumption, the program will indicate whether the assumption is too low or too high. If the guess is correct, the game will print a congratulatory message and end.

Build

To build it using cargo, run:

$ cargo build

Run

To compile and execute it using cargo, run:

$ cargo run

Example:

$ cargo run
   Compiling guessing_game v0.1.0 (/path/guessing_game)
    Finished dev [unoptimized + debuginfo] target(s) in 0.33s
     Running `target/debug/guessing_game`
Guess the number!
Please guess a number between 1 and 100:
5
You guessed: 5
Your guess was too low.

This program can be found explained in the Rust book.

About

Here’s how it works: the program will generate a random int between 1 and 100. It will then prompt the player to enter a guess. After a guess is entered, the program will indicate whether the guess is too low or too high. If the guess is correct, the game will print a congratulatory message and exit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages