This commit is contained in:
Eric Ampire
2026-08-23 19:39:56 -04:00
parent 77f55fdb6b
commit 912422afad
+30 -13
View File
@@ -1,18 +1,35 @@
use rand::Rng;
use std::cmp::Ordering;
use std::io::stdin;
fn main() -> () {
let data: Result<i32, String> = Result::Ok(32);
match data {
Ok(d) => println!("32 bit: {}", data.unwrap()),
Err(e) => println!("Error: {}", e),
}
}
#[derive(Debug)]
struct Point {
x: u32,
y: u32,
x: f64,
y: f64,
}
fn main() {
println!("Please enter a number");
let x = 2;
println!("The values {x}");
println!("The values {}", x);
println!("The values {0} x {0} = {1}", x, x * x);
let point = Point { y: 12, x: 34 };
trait Area {
fn area(&self) -> f64;
}
impl Point {
fn plus(&self, other: &Point) -> Point {
Point {
x: self.x + other.x,
y: self.y + other.y,
}
}
}
impl Area for Point {
fn area(&self) -> f64 {
todo!()
}
}
#[derive(Debug)]
struct Line(Point, Point);