Project: Blackboard (Revisited)
In the good old days before computers, teachers might punish a student by asking them to write on the blackboard 100 times the error of their ways. Bart is seen doing this in the opening of the Simpsons. If Bart only knew how to program, he would make short work of this task. Write a program that prints a brief message multiple times. The first command line argument should indicate the number of times to print the message. The second command line argument should specify the message to print.
Output
$ rustc Blackboard2.rs
error: unknown format trait `s`
--> Blackboard2.rs:17:38
|
17 | println!("{}", format!("Syntax: {0:s} count message", 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[E0425]: cannot find value `args` in this scope
--> Blackboard2.rs:16:5
|
16 | if args.len() != 3 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
10 + use std::env::args;
|
error[E0425]: cannot find function `exit` in this scope
--> Blackboard2.rs:18:3
|
18 | exit(1);
| ^^^^ not found in this scope
|
help: consider importing this function
|
10 + use std::process::exit;
|
error[E0425]: cannot find value `Utils` in this scope
--> Blackboard2.rs:21:22
|
21 | let repeats:isize = Utils.stoiWithDefault(args[1], REPEATS);
| ^^^^^ not found in this scope
error[E0425]: cannot find value `args` in this scope
--> Blackboard2.rs:21:44
|
21 | let repeats:isize = Utils.stoiWithDefault(args[1], REPEATS);
| ^^^^ not found in this scope
|
help: consider importing this function
|
10 + use std::env::args;
|
error[E0425]: cannot find value `args` in this scope
--> Blackboard2.rs:23:12
|
23 | if strlen(args[2]) > 0 {
| ^^^^ not found in this scope
|
help: consider importing this function
|
10 + use std::env::args;
|
error[E0425]: cannot find value `args` in this scope
--> Blackboard2.rs:24:15
|
24 | message = &(args[2]);
| ^^^^ not found in this scope
|
help: consider importing this function
|
10 + use std::env::args;
|
error[E0425]: cannot find function `strlen` in this scope
--> Blackboard2.rs:23:5
|
23 | if strlen(args[2]) > 0 {
| ^^^^^^ not found in this scope
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0425`.