From ef1bf4921ee4127d461eec03a14c9070d193345c Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Mon, 11 Feb 2019 16:59:01 -0500 Subject: Init. --- xmas/.gitignore | 2 + xmas/Cargo.lock | 4 ++ xmas/Cargo.toml | 7 ++++ xmas/out.txt | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ xmas/src/main.rs | 42 ++++++++++++++++++++ 5 files changed, 169 insertions(+) create mode 100644 xmas/.gitignore create mode 100644 xmas/Cargo.lock create mode 100644 xmas/Cargo.toml create mode 100644 xmas/out.txt create mode 100644 xmas/src/main.rs (limited to 'xmas') diff --git a/xmas/.gitignore b/xmas/.gitignore new file mode 100644 index 0000000..53eaa21 --- /dev/null +++ b/xmas/.gitignore @@ -0,0 +1,2 @@ +/target +**/*.rs.bk diff --git a/xmas/Cargo.lock b/xmas/Cargo.lock new file mode 100644 index 0000000..033bd72 --- /dev/null +++ b/xmas/Cargo.lock @@ -0,0 +1,4 @@ +[[package]] +name = "xmas" +version = "0.1.0" + diff --git a/xmas/Cargo.toml b/xmas/Cargo.toml new file mode 100644 index 0000000..d10c790 --- /dev/null +++ b/xmas/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "xmas" +version = "0.1.0" +authors = ["Adam Carpenter "] +edition = "2018" + +[dependencies] diff --git a/xmas/out.txt b/xmas/out.txt new file mode 100644 index 0000000..55ae012 --- /dev/null +++ b/xmas/out.txt @@ -0,0 +1,114 @@ + +On the 1st day of Christmas, +My true love gave to me +A partridge in a pear tree + +On the 2nd day of Christmas, +My true love gave to me +Two turtle doves and +A partridge in a pear tree + +On the 3rd day of Christmas, +My true love gave to me +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 4th day of Christmas, +My true love gave to me +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 5th day of Christmas, +My true love gave to me +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 6th day of Christmas, +My true love gave to me +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 7th day of Christmas, +My true love gave to me +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 8th day of Christmas, +My true love gave to me +Eight maids a-milking +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 9th day of Christmas, +My true love gave to me +Nine ladies dancing +Eight maids a-milking +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 10th day of Christmas, +My true love gave to me +Ten lords a-leaping +Nine ladies dancing +Eight maids a-milking +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 11th day of Christmas, +My true love gave to me +Eleven pipers piping +Ten lords a-leaping +Nine ladies dancing +Eight maids a-milking +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree + +On the 12th day of Christmas, +My true love gave to me +Twelve drummers drumming +Eleven pipers piping +Ten lords a-leaping +Nine ladies dancing +Eight maids a-milking +Seven swans a-swimming +Six geese a-laying +Five golden rings +Four calling birds +Three French hens +Two turtle doves and +A partridge in a pear tree diff --git a/xmas/src/main.rs b/xmas/src/main.rs new file mode 100644 index 0000000..e725a26 --- /dev/null +++ b/xmas/src/main.rs @@ -0,0 +1,42 @@ +fn main() { + let days = [ + "1st", + "2nd", + "3rd", + "4th", + "5th", + "6th", + "7th", + "8th", + "9th", + "10th", + "11th", + "12th", + ]; + let gifts = [ + "A partridge in a pear tree", + "Two turtle doves and", + "Three French hens", + "Four calling birds", + "Five golden rings", + "Six geese a-laying", + "Seven swans a-swimming", + "Eight maids a-milking", + "Nine ladies dancing", + "Ten lords a-leaping", + "Eleven pipers piping", + "Twelve drummers drumming", + ]; + + // for each day + for mut each in 0..12 { + println!("\nOn the {} day of Christmas,", days[each]); + println!("My true love gave to me"); + + // print associated lyrics + for i in (0..each+1).rev() { + println!("{}", gifts[i]); + } + + } +} -- cgit v1.2.3