Implement a struct Complex representing a complex number. Write a constructor as well as properties for accessing the real part and the imaginary part of the complex number. The following operators should be implemented with operator overloading: +,-,*,/,==,!= Add an implicit and an explicit conversion operator that can convert between complex numbers and double. Override the methods Equals, ToString and GetHashCode (all inherited from Object)
Har du styr på hvad et komplekst tal er ? (det går jeg næsten ud fra eftersom du har fået opgaven)
Det er et tal med en reel og en imaginær del. Hvis du starter med at lave en struct, som indeholder en double til hhv. den reelle og imaginære del, er du kommet langt.
Så skal du implementere diverse operatorer og metoder, efter regnereglerne for komplekse tal: The following operators should be implemented with operator overloading: +,-,*,/,==,!= Add an implicit and an explicit conversion operator that can convert between complex numbers and double. Override the methods Equals, ToString and GetHashCode (all inherited from Object)
Lav en struct med 2 fields og implementer operatorerne.
Hvis du ved hvordan operatorerne fungerer matematisk, så burde det være nemt at gå til.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.