Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -1,15 +1,19 @@
|
|||
use std::io;
|
||||
use std::io::{self, BufRead};
|
||||
|
||||
fn main() {
|
||||
// #![allow(unstable)] // Currently required whilst Rust 1.0 is finalised
|
||||
let a: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
let b: i32 = from_str(io::stdin().read_line().unwrap().trim().as_slice()).unwrap();
|
||||
|
||||
let result =
|
||||
match (a, b) {
|
||||
(a, b) if a < b => format!("{0} is less than {1}" , a , b),
|
||||
(a, b) if a == b => format!("{0} equals {1}" , a , b),
|
||||
(a, b) => format!("{0} is greater than {1}" , a , b),
|
||||
};
|
||||
println!("{0}" , result);
|
||||
let mut reader = io::stdin();
|
||||
let mut buffer = String::new();
|
||||
let mut lines = reader.lock().lines().take(2);
|
||||
let nums: Vec<i32>= lines.map(|string|
|
||||
string.unwrap().trim().parse().unwrap()
|
||||
).collect();
|
||||
let a: i32 = nums[0];
|
||||
let b: i32 = nums[1];
|
||||
if a < b {
|
||||
println!("{} is less than {}" , a , b)
|
||||
} else if a == b {
|
||||
println!("{} equals {}" , a , b)
|
||||
} else if a > b {
|
||||
println!("{} is greater than {}" , a , b)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue