Rename sheet folders to assure proper sorting

This commit is contained in:
Lukas Kalbertodt
2017-02-16 15:12:56 +01:00
parent aaf0332117
commit b3664c6ffd
74 changed files with 0 additions and 0 deletions

31
aufgaben/sheet07/sol1/fib.rs Executable file
View File

@ -0,0 +1,31 @@
struct Fib {
curr: u64,
last: u64,
}
impl Fib {
fn new() -> Self {
Fib {
curr: 1,
last: 0,
}
}
}
impl Iterator for Fib {
type Item = u64;
fn next(&mut self) -> Option<Self::Item> {
let new = self.last + self.curr;
self.last = self.curr;
self.curr = new;
Some(self.last)
}
}
fn main() {
for i in Fib::new().take(20) {
println!("{}", i);
}
}