Arithmetic/Complex: Difference between revisions
Content added Content deleted
(+ Pascal) |
(→{{header|C++}}: The example didn't output) |
||
Line 180: | Line 180: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
<cpp> |
<cpp> |
||
#include <iostream> |
|||
#include <complex> |
#include <complex> |
||
using std::complex; |
using std::complex; |
||
Line 186: | Line 187: | ||
complex<double> a(1.0, 1.0); |
complex<double> a(1.0, 1.0); |
||
complex<double> b(3.14159, 1.25); |
complex<double> b(3.14159, 1.25); |
||
complex<double> c; |
|||
// addition |
// addition |
||
std::cout << a + b << std::endl; |
|||
// multiplication |
// multiplication |
||
std::cout << a * b << std::endl; |
|||
// inversion |
// inversion |
||
std::cout << 1.0 / a << std::endl; |
|||
// negation |
// negation |
||
std::cout << -a << std::endl; |
|||
} |
} |
||
</cpp> |
</cpp> |