复数
来源:互联网 发布:南风知我意 编辑:程序博客网 时间:2024/05/16 18:58
Copyright (c) 2014软件技术1班 // All rights reserved. // 作 者:A17 // 完成日期:2014年12月14日 // 版 本 号:v1.0 // using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication46{ public struct Complex { public int Trad; public int ImaginPart; public Complex(int RealPart, int ImaginPart) { this.Trad = RealPart; this.ImaginPart = ImaginPart; } public static Complex operator +(Complex a, Complex b) { return new Complex(a.Trad + b.Trad, a.ImaginPart + b.ImaginPart); } public static Complex operator -(Complex a, Complex b) { return new Complex(a.Trad - b.Trad, a.ImaginPart - b.ImaginPart); } public override string ToString() { return (String.Format("{0}+{1}i", Trad, ImaginPart)); } } class TestComplex { static void Main() { Complex Trad1 = new Complex(1, 2); Complex Trad2 = new Complex(3, 4); Complex complexAdd = Trad1 + Trad2; Console.WriteLine("第一个复数:{0}", Trad1); Console.WriteLine("第二个复数:{0}", Trad2); Console.WriteLine("两个复数之和:{0}", Trad1 + Trad2); Console.WriteLine("两个复数之差:{0}", Trad1 - Trad2); Console.ReadKey(); } }}
<img src="http://img.blog.csdn.net/20141214193419349?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvb2sxMjM0NTZqaQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
总结,不会做,百度的
0 0
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- 复数
- eclipse在线安装svn插件
- 《深入理解Java虚拟机》读书笔记7——线程安全与锁优化
- DeepID-Net:multi-stage and deformable deep convolutional neural network for object detection
- 兔子--两部手机怎么通过蓝牙连接
- opengl 使用 vc6.0中win32控制台工程去掉控制台窗口
- 复数
- STM32学习笔记1-点亮LED
- 第16周上机实践项目2——用指针玩字符串(5)
- 大数据处理之道 (MATLAB 篇(二))
- 第16周上机实践项目1--逆序输出数组
- SQL编程:判断一个字符是数字字符、字母字符还是其他字符
- 1600: [Usaco2008 Oct]建造栅栏
- highcharts图表合唱篇:如何结合Renderer.circle渲染类实现一些无厘头的需求如圆环内环颜色填充
- 杭州市萧山区邮政网点