Juliet set program written by C #. Net

Source: Internet
Author: User

I chose a physics course, and the assignment left by the teacher tried to write it in C. Share the program code and share it with you.

Code:

Using System;

Using System. Collections. Generic;

Using System. ComponentModel;

Using System. Data;

Using System. Drawing;

Using System. Linq;

Using System. Text;

Using System. Windows. Forms;

 

Namespace WindowsFormsApplication2

{

Public partial class Form1: Form

{

Public Form1 ()

{

InitializeComponent ();

}

// Plural

Public class Complex

{

// Default constructor

 

Public Complex ()

: This (0, 0)

{

}

 

// Only real-part Constructors

 

Public Complex (double real)

: This (real, 0)

{

}

 

// Constructed from the real and virtual parts

 

Public Complex (double real, double image)

{

This. real = real;

This. image = image;

}

 

Private double real;

 

Public double Real

{

Get {return real ;}

Set {real = value ;}

}

 

Private double image;

 

// The imaginary part of the plural number

 

Public double Image

{

Get {return image ;}

Set {image = value ;}

}

 

// Overload Addition

 

Public static Complex operator + (Complex c1, Complex c2)

{

Return new Complex (c1.real + c2.real, c1.image + c2.image );

}

 

// Overload Subtraction

 

Public static Complex operator-(Complex c1, Complex c2)

{

Return new Complex (c1.real-c2.real, c1.image-c2.image );

}

 

// Overload Multiplication

 

Public static Complex operator * (Complex c1, Complex c2)

{

Return new Complex (c1.real * c2.real-c1.image * c2.image, c1.image * c2.real + c1.real * c2.image );

}

 

}

Private void button#click (object sender, EventArgs e)

{

Int nColor;

Int nRed;

Int nGreen;

Int nBlue;

Double cx;

Double cy;

& Nbs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.