From 2ed9f7636171264f6c461dea16a5d4b2435d06bf Mon Sep 17 00:00:00 2001 From: GuilhermeWerner Date: Thu, 21 Jan 2021 15:14:59 -0300 Subject: [PATCH] Add Rust Hello Example --- Cargo.toml | 4 ++++ Examples/Rust/Hello.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 Examples/Rust/Hello.rs diff --git a/Cargo.toml b/Cargo.toml index 0846764..a73b84e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,7 @@ path = "Source/Library.rs" [dependencies] libc = "0.2.0" + +[[example]] +name="Hello" +path = "Examples/Rust/Hello.rs" diff --git a/Examples/Rust/Hello.rs b/Examples/Rust/Hello.rs new file mode 100644 index 0000000..1230d0b --- /dev/null +++ b/Examples/Rust/Hello.rs @@ -0,0 +1,11 @@ +#![allow(non_snake_case)] + +fn main() { + let num1 = 1.0; + let num2 = 2.0; + + println!("Added: {}", Library::Add(num1, num2)); + println!("Subtracted: {}", Library::Subtract(num1, num2)); + println!("Multiplied: {}", Library::Multiply(num1, num2)); + println!("Divided: {}", Library::Divide(num1, num2)); +}