trainings/AdvancedCppV2/Presentation/exercises/complex/README.md

510 B

Linux compilation

> mkdir build
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make

Exercise 1

Write a function that creates std::complex number from two provided numbers. If the types of numbers are different, it should create std::complex of the first parameter. Usage:

std::complex<int> a = makeComplex(4, 5);        // both ints
std::complex<double> b = makeComplex(3.0, 2.0); // both doubles
std::complex<int> c = makeComplex(1, 5.0); // int, double -> takes int