Last active
April 14, 2018 11:19
-
-
Save davidpdrsn/14dfbcfbc9fe0f9fc38613a4736506f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{fs::File, io::prelude::*}; | |
| fn main() { | |
| let mut file = File::open("numbers.txt").unwrap(); | |
| let mut s = String::new(); | |
| file.read_to_string(&mut s).unwrap(); | |
| let mut acc: Vec<i32> = s.lines().map(|line| line.parse().unwrap()).collect(); | |
| acc.sort_unstable(); | |
| acc.iter().take(10).for_each(|n| println!("{}", n)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment