trainings/AdvancedCppV2/Presentation/exercises/complex
2024-04-26 14:09:43 +02:00
..
soulutions AdvC++ - pierwszy commit 2024-04-25 09:39:28 +02:00
CMakeLists.txt AdvC++ - pierwszy commit 2024-04-25 09:39:28 +02:00
complex.cpp AdvC++ - zadanie z complex - tworzeniem liczb zespolonych różnych typów za pomocą template 2024-04-26 14:09:43 +02:00
README.md AdvC++ - pierwszy commit 2024-04-25 09:39:28 +02:00

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