start of some of the projects
This commit is contained in:
parent
a60ad4721f
commit
e405e2271f
7
guessing_game/Cargo.lock
generated
Normal file
7
guessing_game/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "guessing_game"
|
||||
version = "0.1.0"
|
6
guessing_game/Cargo.toml
Normal file
6
guessing_game/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "guessing_game"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
23
guessing_game/src/main.rs
Normal file
23
guessing_game/src/main.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
println!("Guess the number!");
|
||||
|
||||
println!("Please input your guess: ");
|
||||
|
||||
// ::new() is an associated type. Function is implemented on this type
|
||||
// Returns a new instance of String
|
||||
let mut guess = String::new();
|
||||
|
||||
let apples = 5; // immutable
|
||||
let mut bananas = 7; // mutable
|
||||
|
||||
io::stdin()
|
||||
.read_line(&mut guess)
|
||||
.expect("Failed to read line!");
|
||||
|
||||
println!("You guessed: {}", guess);
|
||||
|
||||
// Ended at start of Recieving user input in ch2
|
||||
// https://rust-book.cs.brown.edu/ch02-00-guessing-game-tutorial.html#receiving-user-input
|
||||
}
|
7
hello_cargo/Cargo.lock
generated
Normal file
7
hello_cargo/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "hello_cargo"
|
||||
version = "0.1.0"
|
6
hello_cargo/Cargo.toml
Normal file
6
hello_cargo/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "hello_cargo"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
3
hello_cargo/src/main.rs
Normal file
3
hello_cargo/src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
BIN
hello_world/main
Executable file
BIN
hello_world/main
Executable file
Binary file not shown.
3
hello_world/main.rs
Normal file
3
hello_world/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, World!")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user