Add maxnumber
This commit is contained in:
14
testaufgaben/.gitignore
vendored
Normal file
14
testaufgaben/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
debug/
|
||||
target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
14
testaufgaben/maxnumber/.gitignore
vendored
Normal file
14
testaufgaben/maxnumber/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
debug/
|
||||
target/
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
8
testaufgaben/maxnumber/Cargo.toml
Normal file
8
testaufgaben/maxnumber/Cargo.toml
Normal file
@@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "maxnumber"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
11
testaufgaben/maxnumber/src/main.rs
Normal file
11
testaufgaben/maxnumber/src/main.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use std::fmt::Error;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
let array = vec![1, 3, 3, 7];
|
||||
|
||||
if let Some(max) = array.iter().max() {
|
||||
println!("Max. number: {}", max);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user