5_5 & 5_6

This commit is contained in:
Mikołaj Rosa 2022-04-26 15:07:36 +02:00
parent 4d9daac7c5
commit 1d817947d6
5 changed files with 53 additions and 2 deletions

View File

@ -0,0 +1,14 @@
#include <iostream>
#include <string>
using namespace std;
template<class T>
T maxx(T a, T b) {
return a > b ? a : b;
}
int main() {
cout << maxx("bdc", "bcd");
}

View File

@ -0,0 +1,29 @@
#include <iostream>
#include <vector>
using namespace std;
template<class T, class T1>
T wypiszTablice(vector<T> tab, T1 a) {
//cout << sizeof(tab);
for (int i = 0; i < tab.size(); i++) {
cout << tab[i] << " ";
}
cout << endl;
return tab[a];
}
int main() {
vector<int> tab1 = {2, 3, 7, 11, 17};
vector<double> tab2 = { 3.14, 6.11, 7.87, 11.21, 19.91 };
vector<char> tab3 = { 'A', 'B', 'c', 'X', '5' };
//cout << sizeof(tab1);
cout << wypiszTablice(tab1, 2) << endl;
cout << wypiszTablice(tab2, 2) << endl;
cout << wypiszTablice(tab3, 2) << endl;
}

View File

@ -139,7 +139,9 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ConsoleApplication1.cpp" /> <ClCompile Include="5_5.cpp" />
<ClCompile Include="5_4.cpp" />
<ClCompile Include="5_6.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -15,7 +15,13 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ConsoleApplication1.cpp"> <ClCompile Include="5_4.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="5_5.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="5_6.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>