I need conj for complex number.
For example complex number X.
I wrote this code, but i dont know how to call it in main.
Kompleks operator ~() const {
return Kompleks(Re() , -Im());
}
You can call it like
int main() {
Kompleks X;
Kompleks conj = ~X;
}
You have just implemented the Complement Operator of the class "Kompleks" ( documentation here ). In your main, if x is a Kompleks object, writing "~x" will yield the conjugate of x. For example :
Kompleks x(1, 2);
Kompleks y(0, 0);
y = ~x;
after this code, y will contain the conjugate of x.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.