Guest User

Untitled

a guest
Jul 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. extern crate rand;
  2.  
  3. use std::io;
  4. use rand::Rng;
  5.  
  6. fn main()
  7. {
  8. println!("数あてゲームです。なにか数字を入れてください");
  9. let mut guess = String::new();
  10. let secret_number = rand::thread_rng().gen_range(1, 101);
  11.  
  12. io::stdin().read_line(&mut guess)
  13. .expect("read_lineに失敗しました");
  14.  
  15. println!("入力した数字は: {}", guess);
  16.  
  17. println!("ランダムな数字は: {}", secret_number);
  18. }
Add Comment
Please, Sign In to add comment