Skip to content

Commit 5d06314

Browse files
committed
add prac14 module for user input and greeting functionality
1 parent 80c0c1c commit 5d06314

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,7 @@ path = "src/prac12.rs"
5858
name = "prac13"
5959
path = "src/prac13.rs"
6060

61+
[[bin]]
62+
name = "prac14"
63+
path = "src/prac14.rs"
6164
[dependencies]

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mod prac10;
1010
mod prac11;
1111
mod prac12;
1212
mod prac13;
13+
mod prac14;
1314

1415
fn main(){
1516
let string_literal:&str = "Hello, Blockchain!";

src/prac14.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::io;
2+
fn main(){
3+
let mut input = String::new();
4+
println!("Please Enter your name:");
5+
io::stdin().read_line(&mut input).expect("Failed to read line");
6+
println!("Hello, !{}", input);
7+
}

0 commit comments

Comments
 (0)