复数的加减

  
// All rights reserved.      
       
// 完成日期:2014年 12月 13 日      
// 版 本 号: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);
            }


        }
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章