複數的加減

  
// 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);
            }


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