Project: Ordinal Date (Revisited)
Write a function to compute the ordinal date. The function should have arguments for month, day and year. Write a second function to determine if the year is a leap year that is used by the first function. Use preconditions to validate the function arguments and postconditions to check the result. You can compute the ordinal date with the following formula:
- for January: d
- for February: d + 31
- for the other months: the ordinal date from March 1 plus 59, or 60 in a leap year
where the ordinal date from March 1 is: floor(30.6m-91.4)+d
and a year is a leap year if it is evenly divisible by 4 but not evenly divisible by 100 unless it is evenly divisible by 400.
See [[Ordinal Date]] and [[Leap Year]]
Output
$ rustc OrdinalDate2.rs
error: unknown format trait `s`
--> OrdinalDate2.rs:47:38
|
47 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!")));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:29
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:35
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:41
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:49
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:42:5
|
42 | if args.len() == 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:43:11
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:43:33
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:44:9
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:44:31
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:45:10
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:45:32
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> OrdinalDate2.rs:49:3
|
49 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find function `floor` in this scope
--> OrdinalDate2.rs:31:10
|
31 | od += (floor(30.6f64 * (M) as f64 - 91.4f64)) as isize;
| ^^^^^ not found in this scope
|
help: use the `.` operator to call the method `floor` on `f64`
|
31 | od += ((30.6f64 * (M) as f64 - 91.4f64).floor() as isize;
| ~ ~~~~~~~~~
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc OrdinalDate2.rs
error: unknown format trait `s`
--> OrdinalDate2.rs:47:38
|
47 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!")));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:29
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:35
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:41
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:49
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:42:5
|
42 | if args.len() == 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:43:11
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:43:33
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:44:9
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:44:31
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:45:10
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:45:32
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> OrdinalDate2.rs:49:3
|
49 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find function `floor` in this scope
--> OrdinalDate2.rs:31:10
|
31 | od += (floor(30.6f64 * (M) as f64 - 91.4f64)) as isize;
| ^^^^^ not found in this scope
|
help: use the `.` operator to call the method `floor` on `f64`
|
31 | od += ((30.6f64 * (M) as f64 - 91.4f64).floor() as isize;
| ~ ~~~~~~~~~
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc OrdinalDate2.rs
error: unknown format trait `s`
--> OrdinalDate2.rs:47:38
|
47 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!")));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:29
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:35
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:41
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:49
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:42:5
|
42 | if args.len() == 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:43:11
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:43:33
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:44:9
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:44:31
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:45:10
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:45:32
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> OrdinalDate2.rs:49:3
|
49 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find function `floor` in this scope
--> OrdinalDate2.rs:31:10
|
31 | od += (floor(30.6f64 * (M) as f64 - 91.4f64)) as isize;
| ^^^^^ not found in this scope
|
help: use the `.` operator to call the method `floor` on `f64`
|
31 | od += ((30.6f64 * (M) as f64 - 91.4f64).floor() as isize;
| ~ ~~~~~~~~~
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc OrdinalDate2.rs
error: unknown format trait `s`
--> OrdinalDate2.rs:47:38
|
47 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!")));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:29
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:35
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:41
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:49
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:42:5
|
42 | if args.len() == 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:43:11
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:43:33
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:44:9
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:44:31
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:45:10
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:45:32
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> OrdinalDate2.rs:49:3
|
49 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find function `floor` in this scope
--> OrdinalDate2.rs:31:10
|
31 | od += (floor(30.6f64 * (M) as f64 - 91.4f64)) as isize;
| ^^^^^ not found in this scope
|
help: use the `.` operator to call the method `floor` on `f64`
|
31 | od += ((30.6f64 * (M) as f64 - 91.4f64).floor() as isize;
| ~ ~~~~~~~~~
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0425`.
$ rustc OrdinalDate2.rs
error: unknown format trait `s`
--> OrdinalDate2.rs:47:38
|
47 | println!("{}", format!("Syntax: {0:s} month day year", utils::program_name().expect("program name should not be empty!")));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:29
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:35
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:41
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error: unknown format trait `d`
--> OrdinalDate2.rs:53:49
|
53 | println!("{}", format!("{0:d}/{1:d}/{2:d} = {3:d} Ordinal Date", month, day, year, od));
| ^
|
= note: the only appropriate formatting traits are:
- ``, which uses the `Display` trait
- `?`, which uses the `Debug` trait
- `e`, which uses the `LowerExp` trait
- `E`, which uses the `UpperExp` trait
- `o`, which uses the `Octal` trait
- `p`, which uses the `Pointer` trait
- `b`, which uses the `Binary` trait
- `x`, which uses the `LowerHex` trait
- `X`, which uses the `UpperHex` trait
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:42:5
|
42 | if args.len() == 4 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:43:11
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:43:33
|
43 | month = Utils.stoiWithDefault(args[1], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:44:9
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:44:31
|
44 | day = Utils.stoiWithDefault(args[2], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find value `Utils` in this scope
--> OrdinalDate2.rs:45:10
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> OrdinalDate2.rs:45:32
|
45 | year = Utils.stoiWithDefault(args[3], 0);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> OrdinalDate2.rs:49:3
|
49 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
7 + use std::process::exit;
|
error[E0425]: cannot find function `floor` in this scope
--> OrdinalDate2.rs:31:10
|
31 | od += (floor(30.6f64 * (M) as f64 - 91.4f64)) as isize;
| ^^^^^ not found in this scope
|
help: use the `.` operator to call the method `floor` on `f64`
|
31 | od += ((30.6f64 * (M) as f64 - 91.4f64).floor() as isize;
| ~ ~~~~~~~~~
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0425`.