复数相加和相减(改)

来源:互联网 发布:淘宝修改为没有发货 编辑:程序博客网 时间:2024/04/28 22:15
// All rights reserved. // 完成日期:2014年 12月 14 日 // 版 本 号:v1.0 // // 问题描述:创建一个程序来把复数显示。该程序提示用户输入赋值数据,然后显示出复数相加减的数据。 // 输入描述:一个实数 // 程序输出:一个虚数using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("输入赋给a的值");
            int a = int.Parse(Console.ReadLine());
            Console.WriteLine("输入赋给b的值");
            int b = int.Parse(Console.ReadLine());
            Console.WriteLine("输入赋给c的值");
            int c = int.Parse(Console.ReadLine());
            Console.WriteLine("输入赋给d的值");
            int d = int.Parse(Console.ReadLine());


            Console.WriteLine("{0},{1}i,{2},{3}i", a, b, c, d);


            Console.WriteLine("两个复数相加的结果为{0}+{1}i", a + c, b + d);
            Console.WriteLine("两个复数相减的结果为{0}+({1}i)", a - c, b - d);
            Console.ReadLine();
        }
        class Complex
        {
            public static int Add(int a, int b, int c, int d)
            {


                return (a + c) + (b + d);
            }
            public static int SubStract(int a, int b, int c, int d)
            {


                return (a - c) + (b - d);
            }


        }
    }
}
0 0
原创粉丝点击