From 80b9b355082c0db4f14a1f35400f0cad9cdb3676 Mon Sep 17 00:00:00 2001 From: Sasza Stanczew Date: Fri, 26 Apr 2024 14:09:43 +0200 Subject: [PATCH] =?UTF-8?q?AdvC++=20-=20zadanie=20z=20complex=20-=20tworze?= =?UTF-8?q?niem=20liczb=20zespolonych=20r=C3=B3=C5=BCnych=20typ=C3=B3w=20z?= =?UTF-8?q?a=20pomoc=C4=85=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/exercises/complex/complex.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/AdvancedCppV2/Presentation/exercises/complex/complex.cpp b/AdvancedCppV2/Presentation/exercises/complex/complex.cpp index 0931381..ab2c5e7 100644 --- a/AdvancedCppV2/Presentation/exercises/complex/complex.cpp +++ b/AdvancedCppV2/Presentation/exercises/complex/complex.cpp @@ -1 +1,15 @@ #include +#include + +template +std::complex makeComplex(T a, U b){ + return std::complex(a,b); +} + +int main(){ + std::complex a = makeComplex(4,5); + std::complex b = makeComplex(3.0,5.2); + std::complex c = makeComplex(1,5.2); + + std::cout << a << std::endl << b << std::endl << c << std::endl; +}