Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 545 Bytes

create-complex.zh.md

File metadata and controls

19 lines (13 loc) · 545 Bytes

创建复数

[![num-badge]][num] [![cat-science-badge]][cat-science]

创建num::complex::Complex类型的复数。复数的实部和虚部必须是同一类型。

extern crate num;

fn main() {
    let complex_integer = num::complex::Complex::new(10, 20);
    let complex_float = num::complex::Complex::new(10.1, 20.1);

    println!("Complex integer: {}", complex_integer);
    println!("Complex float: {}", complex_float);
}