From 574c73fa29bccd1fbcf59874b4682948c8d19875 Mon Sep 17 00:00:00 2001 From: maja Date: Mon, 12 Nov 2018 22:59:01 +0100 Subject: [PATCH 1/2] added solutions for first exercise --- .gitignore | 2 + exercise/01/app/app.cpp | Bin 0 -> 1426 bytes exercise/01/app/app.vcxproj | 170 ++++++++++++++++++ exercise/01/app/app.vcxproj.filters | 30 ++++ .../01/app/dynamic_library_with_implib.cpp | Bin 0 -> 204 bytes exercise/01/app/pch.cpp | Bin 0 -> 430 bytes exercise/01/app/pch.h | Bin 0 -> 1262 bytes exercise/01/e01.sln | 2 + 8 files changed, 204 insertions(+) create mode 100644 exercise/01/app/app.cpp create mode 100644 exercise/01/app/app.vcxproj create mode 100644 exercise/01/app/app.vcxproj.filters create mode 100644 exercise/01/app/dynamic_library_with_implib.cpp create mode 100644 exercise/01/app/pch.cpp create mode 100644 exercise/01/app/pch.h diff --git a/.gitignore b/.gitignore index 4164f21..f4f972c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ *.ipdb *.iobj *.exp +*.db-shm +*.db-wal diff --git a/exercise/01/app/app.cpp b/exercise/01/app/app.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6f9996c0b9b17721f95ceb7d18dafb89b091fc7f GIT binary patch literal 1426 zcmcJOOK;Oa6ot>$mG}>qyGanFr2-ZqR0@TbiYP(?c1TqcyRD_PiJZ`f5Pu!|-8)WQ zr!J2L8ad94@8g_v&;0tisa)rpXsT~Yl_^%DIr~#}coIF*hVIAo$eL-Pr3!LJI@9h0 zkqLD=+M<50G4DBj#=e`B9bWw*GbMVeoqx*h>C$mPC&5KkuG3pv&}&L!tqpj zp<)JV)3`zxf$J`^6gAF$$^qMgzB!oZWEq>tu{Y!Ue>hfb3y>8c3`pMVP(yvvXXY?u zHt)cCN<`pj(|gS`K*bTP2k;n^9V+zEC?Th-udI~QYd!P-nXXWZx9nV)T!--16w z+?8JHxqp32)EM1Qd{s1(OS%>CjP(>` zVVY5+D`RS#ODmrSRa%YF=HUac|B?E$(&1HZ9pe+ClLq%Sace^Hcl>s4`PFY`<@Ug6 oy+gPID{UUWRd?(B{=S&Prhc~OrMfEBT + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {843D77A9-6E04-4515-91D5-A010A5CDF8E0} + Win32Proj + app + 10.0.17134.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + static_library.lib;dynamic_library_with_implib.lib;%(AdditionalDependencies) + C:\day1\exercise\01\dll2\$(Platform)\$(Configuration)\;C:\day1\exercise\01\lib\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/exercise/01/app/app.vcxproj.filters b/exercise/01/app/app.vcxproj.filters new file mode 100644 index 0000000..45e6ae5 --- /dev/null +++ b/exercise/01/app/app.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/exercise/01/app/dynamic_library_with_implib.cpp b/exercise/01/app/dynamic_library_with_implib.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b5ee22c1b7bad6ede80995f2dbd5c1d2c9c4ecb9 GIT binary patch literal 204 zcmZvV%?g5G5Jk_{pm&hkn2R>is)q?pO+hT`Q-tuyft&e$=G=SU^OlB=3oShb zB{3VG1l=<#M)uVDS+in^yepL}+o<738eMSv?yU2w=D?Xjt!64o+#9qrzx4!m?s@r) WczCAQ+5J&5son?qj+~sGe0~6tm?0Se literal 0 HcmV?d00001 diff --git a/exercise/01/app/pch.cpp b/exercise/01/app/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a38f8a37da858b0e7a4a577210e923c883ac97f3 GIT binary patch literal 430 zcma)(OAdlS5JYQj;vFWsRoUwaJO;ubLXfO} ziM!*RK?b#&)PqF4LX~Q_GVq=g$>^{f<-{7@$r|ykmqm|MwtC_%l{t|TJS9Jpalvn} ztpC7C!Dg_+`-h+El+KlNtsDc|GOvyF+iK(A-j!r1ot!0T2mdlziM{46Ghg8k=#H+V zM?tLvNCnoo3Y&aHb%nm~4lL&e!^r!5 zY>)Yt7?F2lcmBR1+QK#-XGNr7XZ8fr!cn3lZ5^Y)vUSfD^AwDN*h^Lw&)lPx++47# zd)SAA*b{C}iSS;`84M~$v>AMrgP7FJ8+gu~LAukhS6*EOJ`b`OdG>3c0~t!sZmv>H zn*HLA@+(*ivq2}#QbRtnCS6sZB|bGHY13EaXpqYpyv1DpS76m1eTdT|r_t-78YQ1T z#<62u5HD*r_L~oQCI!E8@(t$Ve*GNp63pmTN&3$4QJrKBuD-fJIu~wfYrcy;aeoU( z{gpDyo!duDy%mVwzd3}ObITpQ?&R3*fD>2bk}TRUp!6E5gQ6*el=X_*#+Q5I8?Z>{ zRy|dAN-mZA&0pz!j#b}5FeyBGiKSg%o7_9|!S#V|#ttsxpDyDUbdaS$838t Date: Tue, 13 Nov 2018 18:39:18 +0100 Subject: [PATCH 2/2] exercise 2 --- exercise/01/app/app.cpp | Bin 1426 -> 1838 bytes exercise/01/app/pch.h | Bin 1262 -> 1374 bytes exercise/01/e01.sln | 10 +++++++++- exercise/02/code.cpp | 14 ++++++++++++++ exercise/02/code.h | 3 +++ exercise/02/test1.cpp | 6 +++--- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/exercise/01/app/app.cpp b/exercise/01/app/app.cpp index 6f9996c0b9b17721f95ceb7d18dafb89b091fc7f..29f00aa14aafeedca49d86a4526681c402fd2a04 100644 GIT binary patch delta 424 zcmZXQJx&8L5QSeuLj)BPO$yT^?EyH=CSD~Du{X+YC@9!7BnLs_f{<^JYj#Gx>ZBLuJxHJr zTCq3IyGc8??7FbO2agj2J7_uW9m@13WaJ%FJBY}hw3&~G*>2P`*qv?((72J}0-L$7 zoW-{i*9F!i;uc}#(kxFwgWmoT|B_n1?4&hm^&efp(pACiNzLRt^ws>|pR))SZ|DCo cxSEB-z!E4kHew?)XUQ{R;r#UY_3&|X1$0+UEC2ui delta 12 UcmZ3-H;J3+|G&-i7$>j-03!hfKmY&$ diff --git a/exercise/01/app/pch.h b/exercise/01/app/pch.h index d87432d37058f4909a1979f297c238023153b462..e5ac5fa98e89cc7b1d268ba1ffc75e2ccf5104f3 100644 GIT binary patch delta 120 zcmaFId5>$uJC*`o1}+ADAk1SZU?^hHV}S9M88U%l$qYFRr3@(ysSFAXHb9YlhGK>i fpt@9sM21`jJDjR*fbuyE=|J^GKwTva8F1AAX>JuW delta 7 Ocmcb|^^SAHI~D*B4+DY# diff --git a/exercise/01/e01.sln b/exercise/01/e01.sln index 6039f77..4b49fbe 100644 --- a/exercise/01/e01.sln +++ b/exercise/01/e01.sln @@ -16,7 +16,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library", "dll1\dyn EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library_with_implib", "dll2\dynamic_library_with_implib.vcxproj", "{4EA09877-C87B-489E-9F80-A921D8E66E46}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{3D4FBC14-0CE8-443D-8003-56737D1BCFA2}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_test", "..\02\simple_test.vcxproj", "{F2F0B29D-E5BA-47BD-A20C-6373652373DB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -58,6 +58,14 @@ Global {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x64.Build.0 = Release|x64 {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.ActiveCfg = Release|Win32 {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.Build.0 = Release|Win32 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Debug|x64.ActiveCfg = Debug|x64 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Debug|x64.Build.0 = Debug|x64 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Debug|x86.ActiveCfg = Debug|Win32 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Debug|x86.Build.0 = Debug|Win32 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Release|x64.ActiveCfg = Release|x64 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Release|x64.Build.0 = Release|x64 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Release|x86.ActiveCfg = Release|Win32 + {F2F0B29D-E5BA-47BD-A20C-6373652373DB}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/exercise/02/code.cpp b/exercise/02/code.cpp index 85e778c..21f9456 100644 --- a/exercise/02/code.cpp +++ b/exercise/02/code.cpp @@ -1,2 +1,16 @@ #include "stdafx.h" #include "code.h" + +void f1(int& a, int& b) +{ + int tmp = a; + a = b; + b = tmp; +} + +void f2(int* first, int* last) +{ + for (; first < last; ++first) + ++(*first); +} + diff --git a/exercise/02/code.h b/exercise/02/code.h index e69de29..a8ba07b 100644 --- a/exercise/02/code.h +++ b/exercise/02/code.h @@ -0,0 +1,3 @@ + +void f1(int& a, int& b); +void f2(int* first, int* last); \ No newline at end of file diff --git a/exercise/02/test1.cpp b/exercise/02/test1.cpp index 33dfab7..29b52ae 100644 --- a/exercise/02/test1.cpp +++ b/exercise/02/test1.cpp @@ -14,14 +14,14 @@ namespace simple_test TEST_METHOD(f1_changes_values) { int a=1, b=2; - //f1(a, b); + f1(a, b); Assert::AreEqual(2, a); Assert::AreEqual(1, b); } TEST_METHOD(f2_increases_all_values_by_one) { int arr[] = { 1, 2, 3 }; - //f2(arr, arr+3); + f2(arr, arr+3); Assert::AreEqual(2, arr[0]); Assert::AreEqual(3, arr[1]); Assert::AreEqual(4, arr[2]); @@ -29,7 +29,7 @@ namespace simple_test TEST_METHOD(f2_works_for_different_number_of_values) { int arr[] = { 2, 4, 6, 8, 10 }; - //f2(arr, arr+5); + f2(arr, arr+5); Assert::AreEqual(3, arr[0]); Assert::AreEqual(5, arr[1]); Assert::AreEqual(7, arr[2]);