做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

asp.net(c#)復數類(復數加減乘除四則運算)

來源:懂視網 責編:小采 時間:2020-11-27 22:45:23
文檔

asp.net(c#)復數類(復數加減乘除四則運算)

asp.net(c#)復數類(復數加減乘除四則運算):我的一個JAVA作業,把它改寫成asp.net(c#)了 代碼如下:protected void Page_Load(object sender, EventArgs e) { complex complex_a = new complex(1.0, 1.0); complex complex_b = new complex(2.0,
推薦度:
導讀asp.net(c#)復數類(復數加減乘除四則運算):我的一個JAVA作業,把它改寫成asp.net(c#)了 代碼如下:protected void Page_Load(object sender, EventArgs e) { complex complex_a = new complex(1.0, 1.0); complex complex_b = new complex(2.0,

我的一個JAVA作業,把它改寫成asp.net(c#)了
代碼如下:
protected void Page_Load(object sender, EventArgs e)
    {
        complex complex_a = new complex(1.0, 1.0);
        complex complex_b = new complex(2.0, 2.0);
        Response.Write("加法運算結果:" + complex_a.complex_add(complex_b).ToString() + "<br />");
        Response.Write("減法運算結果:" + complex_a.complex_minus(complex_b).ToString() + "<br />");
        Response.Write("乘法運算結果:" + complex_a.complex_multi(complex_b).ToString() + "<br />");
        Response.Write("除法運算結果:" + complex_a.complex_divide(complex_b).ToString());
    }
    //design by 阿會楠 來自:搜索吧 sosuo8.com
    public class complex
    {
        //復數中的實部
        private double complex_real;
        //復數中的虛部
        private double complex_imagin;

        //構造函數
        public complex(double r, double i)
        {
            complex_real = r;
            complex_imagin = i;
        }

        //重寫ToString()方法 
        public override string ToString()
        {
            return this.complex_real + "+" + this.complex_imagin + "i";
        }

        //復數加法運算
        public complex complex_add(complex c)
        {
            //取得加法運算后的實部
            double complex_real = this.complex_real + c.complex_real;

            //取得加法運算后的虛部
            double complex_imagin = this.complex_imagin + c.complex_imagin;

            //返回一個復數類
             return new complex(complex_real,complex_imagin);
        }

        //復數減法運算
        public complex complex_minus(complex c)
        {
            //取得減法運算后的實部
            double complex_real = this.complex_real - c.complex_real;

            //取得減法運算后的虛部
            double complex_imagin = this.complex_imagin - c.complex_imagin;

            //返回一個復數類
            return new complex(complex_real, complex_imagin);
        }

        //乘法運算
        public complex complex_multi(complex c)
        {
            //取得乘法運算后的實部
            double complex_real = this.complex_real * c.complex_real - this.complex_imagin * c.complex_imagin;

            //取得乘法運算后的虛部
            double complex_imagin = this.complex_real * c.complex_imagin + this.complex_imagin * c.complex_real;

            //返回一個復數類
            return new complex(complex_real, complex_imagin);
        }

        //除法運算結果 (a+bi)/(c+di)=(a+bi)(c-di)/(c+di)(c-di)
        public complex complex_divide(complex c)
        {
            //取得(c+di)(c-di)的值
            double d = c.complex_real * c.complex_real + c.complex_imagin * c.complex_imagin;

            //取得除法運算后的實部
            double complex_real = (this.complex_real * c.complex_real + this.complex_imagin * c.complex_imagin) / d;

            //取得除法運算后的虛部
            double complex_imagin = (this.complex_real * (-c.complex_imagin) + this.complex_imagin * c.complex_real) / d;

            //返回一個復數類
            return new complex(complex_real, complex_imagin);
        }
    }


運行結果:

代碼如下:
加法運算結果:3+3i  
減法運算結果:-1+-1i  
乘法運算結果:0+4i  
除法運算結果:0.5+0i 

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

asp.net(c#)復數類(復數加減乘除四則運算)

asp.net(c#)復數類(復數加減乘除四則運算):我的一個JAVA作業,把它改寫成asp.net(c#)了 代碼如下:protected void Page_Load(object sender, EventArgs e) { complex complex_a = new complex(1.0, 1.0); complex complex_b = new complex(2.0,
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 长岭县| 宜兰县| 兴安县| 安阳县| 曲松县| 中江县| 常熟市| 定结县| 宾阳县| 当雄县| 长治县| 上栗县| 岳阳市| 老河口市| 绥江县| 格尔木市| 乌拉特后旗| 林周县| 赤壁市| 华安县| 文化| 苗栗县| 合江县| 淮南市| 板桥市| 阜平县| 莫力| 准格尔旗| 分宜县| 郸城县| 汝南县| 沂南县| 邛崃市| 五莲县| 喀喇| 麟游县| 聂拉木县| 金乡县| 宜春市| 蓝山县| 景东|