Search
 
SCRIPT & CODE EXAMPLE
 

RUST

Read a floating point number from stdin

// Read a floating point number from stdin

use std::io;

fn main() {
    let num:f64;  //=0.0;
    let mut input = String::new();
    
    println!("Enter number: ");
    io::stdin().read_line(&mut input).expect("Not a valid string");
    num = input.trim().parse().expect("Not a valid number");
    println!("Number is: {}",num);
}
Comment

PREVIOUS NEXT
Code Example
Rust :: armanriazi•rust•collection•hashmap•avoid_of_duplicate 
Rust :: rust named tuple 
Rust :: key value in for loop rust 
Rust :: rust `cfg` which is always true / false 
Rust :: armanriazi•rust•error•[E0046]: not all trait items implemented, missing: `summarize_author` 
Rust :: armanriazi•rust•interior-mutability•cell 
Rust :: rust Clean way to get Option::unwrap_or_else behaviour with an Option<&T 
Rust :: rust•armanriazi•borrowchecker•ownership 
Rust :: initialize empty vec in rust 
Rust :: armanriazi•rust•error•[E0368]: binary assignment operation `+=` cannot be applied to type `T` 
Rust :: how to check if a thing is in a vector in rust 
Rust :: rust array literal 
Lua :: roblox for children loop 
Lua :: Get number of values in a table lua 
Lua :: how to make a part rotate roblox 
Lua :: roblox get player by name 
Lua :: forever loop in lua 
Lua :: how to give yourself money in your roblox game 
Lua :: error: LINK : fatal error LNK1561: entry point must be defined 
Lua :: lua get time 
Lua :: fivem commands lua example 
Lua :: roblox player chatter event 
Lua :: for loop in robox 
Lua :: lua patterns 
Lua :: lua table concanation 
Matlab :: matlab inverse z transform 
Matlab :: matlab single and double 
Basic :: vb string to int32 
Basic :: wussup 
Elixir :: elixir enum each 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =