use std::io;
fn main() {
println!("please enter number of students");
let mut stude = "some_string".to_string();
io::stdin().read_line(&mut stude).expect("Failed to read input");
let stude = stude.trim().parse().expect("conversion failure");
//let stude = stude as usize ;
let mut input :String = String::new();
let mut j : Vec<String> = Vec::new();
for some_int in 0..stude {
println!("\n#{} = ",some_int);
io::stdin().read_line(&mut input).expect("Failed to read input");
j.push(input);
}
for some_string in j.iter() {
println!("{}",some_string);
}
}
here is the error exception :
C:\Users\Dell\rust\io>cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target\debug\io.exe`
please enter number of students
4
thread 'main' panicked at 'conversion failure: ParseIntError { kind: InvalidDigit }',
libcore\result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: process didn't exit successfully: `target\debug\io.exe` (exit code: 101)