Ilovalar
Dastur kodi:
using System;
public struct Complex
{ public double real;
public double mavhum;
public Complex(double real, double mavhum)
{
this.real = real;
this.mavhum = mavhum;
}
public static Complex operator +(Complex one, Complex two)
{
return new Complex(one.real + two.real, one.mavhum + two.mavhum);
}
public static Complex operator -(Complex one, Complex two)
{
return new Complex(one.real - two.real, one.mavhum - two.mavhum);
}
public static Complex operator *(Complex one, Complex two)
{
return new Complex(one.real * two.real - one.mavhum * two.mavhum, one.real * two.mavhum + two.real * one.mavhum);
}
public static Complex operator /(Complex one, Complex two)
{
return new Complex((one.real * two.real + one.mavhum * two.mavhum) / (two.real * two.real + two.mavhum * two.mavhum),
(two.real * one.mavhum - one.real * two.mavhum) / (two.real * two.real + two.mavhum * two.mavhum));
}
public override string ToString()
{
if (mavhum < 0)
{
return (String.Format("{0}{1}i", real, mavhum));
}
else {
return (String.Format("{0}+{1}i", real, mavhum));
}
}
}
class Demo
{ static void Main()
{ Complex val1 = new Complex(7, 1);
Complex val2 = new Complex(2, 6);
Complex qosh = val1 + val2;
Complex ayr = val1 - val2;
Complex kop = val1 * val2;
Complex bol = val1 / val2;
Console.WriteLine("1-son: {0}", val1);
Console.WriteLine("2-son: {0}", val2);
Console.WriteLine("Qo'shilma: {0}", qosh);
Console.WriteLine("Ayirma: {0}", ayr);
Console.WriteLine("Ko'payma: {0}", kop);
Console.WriteLine("Bo'linma: {0}", bol);
Console.ReadLine();
}
}
Dastur natijasi:
1-rasm
2-rasm
Foydalanilgan adabiyotlar va internet sayitlari.
1.https://hozir.org/kompleks-sonlar-haqida-tushuncha.html
2. https://docs.microsoft.com/en-us/dotnet/csharp
3. https://uz.wikipedia.org
4. https://metanit.com/sharp/tutorial
5. https://www.c-sharpcorner.com
6. https://www.tutorialspoint.com
7. ALGEBRA VA SONLAR NAZARIYASI Sh.A.Ayupov, B.A.Omirov, A.X.Xudoyberdiyev, F.H.Haydarov
Do'stlaringiz bilan baham: |