Project: Temperature Table
Write a program that displays a temperature conversion table. The table should have columns for Celcius, Fahrenheit, Kelvin and Rankine scales. Display rows for -270°C to 120°C in increments of 5°C.
See [[Conversion of units of temperature]]
Output
$ rustc TemperatureTable.rs
error: unknown format trait `s`
--> TemperatureTable.rs:13:31
|
13 | println!("{}", format!("{0:>7s} {1:>7s} {2:>7s} {3:>7s}", "C", "F", "K", "R"));
| ^
|
= 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 `s`
--> TemperatureTable.rs:13:39
|
13 | println!("{}", format!("{0:>7s} {1:>7s} {2:>7s} {3:>7s}", "C", "F", "K", "R"));
| ^
|
= 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 `s`
--> TemperatureTable.rs:13:47
|
13 | println!("{}", format!("{0:>7s} {1:>7s} {2:>7s} {3:>7s}", "C", "F", "K", "R"));
| ^
|
= 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 `s`
--> TemperatureTable.rs:13:55
|
13 | println!("{}", format!("{0:>7s} {1:>7s} {2:>7s} {3:>7s}", "C", "F", "K", "R"));
| ^
|
= 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 `f`
--> TemperatureTable.rs:21:34
|
21 | println!("{}", format!("{0:7.2f} {1:7.2f} {2:7.2f} {3:7.2f}", degreesC, degreesF, degreesK, degreesR));
| ^
|
= 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 `f`
--> TemperatureTable.rs:21:43
|
21 | println!("{}", format!("{0:7.2f} {1:7.2f} {2:7.2f} {3:7.2f}", degreesC, degreesF, degreesK, degreesR));
| ^
|
= 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 `f`
--> TemperatureTable.rs:21:52
|
21 | println!("{}", format!("{0:7.2f} {1:7.2f} {2:7.2f} {3:7.2f}", degreesC, degreesF, degreesK, degreesR));
| ^
|
= 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 `f`
--> TemperatureTable.rs:21:61
|
21 | println!("{}", format!("{0:7.2f} {1:7.2f} {2:7.2f} {3:7.2f}", degreesC, degreesF, degreesK, degreesR));
| ^
|
= 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[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> TemperatureTable.rs:18:50
|
18 | let mut degreesF:f64 = 1.8f64 * degreesC + 32.f64;
| ^^^
|
help: if intended to be a floating point literal, consider adding a `0` after the period
|
18 | let mut degreesF:f64 = 1.8f64 * degreesC + 32.0f64;
| +
error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0610`.