How to create a 2D point data structure with two floating-point numbers in Rust

1 Answer

0 votes
struct Point {
	x: f32,
    y: f32,
}

fn main() {
    let p = Point {x: 6.89, y: 5.12};

    println!("{} {}", p.x, p.y);
}




/*
run:

6.89 5.12

*/

 



answered Dec 27, 2022 by avibootz
...