Skip to content

Suns627/My-rust-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

There are some easy math fuction,there are add......
You can use the add function too add,and use subtract......
There is code:
pub mod math_functions {
    pub fn add(a: i32, b: i32) -> i32 {
        a + b
    }
    pub fn subtract(a: i32, b: i32) -> i32 {
        a - b
    }
    pub fn multiply(a: i32, b: i32) -> i32 {
        a * b
    }
    pub fn divide(a: i32, b: i32) -> Result<i32, &'static str> {
        if b == 0 {
            Err("Cannot divide by zero")
        } else {
            Ok(a / b)
        }
    }
}

And use distance:
fn main(){
    let ax: i32 = ......;
    let ......
    ......
    println!("{}",distance(ax,ay,bx,by));
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages