Compare commits

...

5 Commits

Author SHA1 Message Date
Aelita4 e658b49225 7_3 2022-05-16 15:36:41 +02:00
Mikołaj Rosa 5a3531337e 7_3_todo 2022-05-09 17:02:51 +02:00
Mikołaj Rosa 8aa47ad5b8 7_2 2022-05-09 16:35:26 +02:00
Mikołaj Rosa 36072aeff8 7_1 2022-05-09 16:08:57 +02:00
Mikołaj Rosa 1d5bd756d6 Add project files. 2022-05-09 15:31:11 +02:00
4 changed files with 300 additions and 0 deletions

31
zadania_lista.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31105.61
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zadania_lista", "zadania_lista\zadania_lista.vcxproj", "{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Debug|x64.ActiveCfg = Debug|x64
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Debug|x64.Build.0 = Debug|x64
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Debug|x86.ActiveCfg = Debug|Win32
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Debug|x86.Build.0 = Debug|Win32
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Release|x64.ActiveCfg = Release|x64
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Release|x64.Build.0 = Release|x64
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Release|x86.ActiveCfg = Release|Win32
{6D03F666-7CD9-42E8-92BB-39E7E1A6AFD4}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {31B83468-0DAA-42EB-9884-B8A0EB1D17F3}
EndGlobalSection
EndGlobal

100
zadania_lista/lab_lista.cpp Normal file
View File

@ -0,0 +1,100 @@
#include <iostream>
#include <algorithm>
#include <list>
using namespace std;
void demo_lista();
list<char>::iterator ListSearch(list<char>& lista, char znak);
void MergeLists(list<int>& L1, list<int>& L2, list<int>& L3);
bool deleteNode(list<char>& lista, int);
void createSortedList(list<int>&, int[], int);
int main() {
//demo_lista();
list<char> lista{ 'a','l','f','c' };
/*list<char>::iterator it = ListSearch(lista, 'g');
if (it == lista.end()) cout << "Nie znaleziono";
else cout << *it;*/
/*auto print_char = [](const char& n) { cout << n << ' '; };
for_each(lista.begin(), lista.end(), print_char); cout << endl;
cout << (deleteNode(lista, 2) ? "Usunieto" : "Nie usunieto") << endl;
for_each(lista.begin(), lista.end(), print_char); cout << endl;*/
}
void demo_lista() {
auto print_char = [](const char& n) { cout << n << ' '; };
list<char> lista{ 'a','l','f','c' };
for_each(lista.begin(), lista.end(), print_char); cout << endl;
for_each(lista.rbegin(), lista.rend(), print_char);
lista.clear();
char znak;
cout << "\nPodaj znaki (Enter, Ctrl-z): ";
while (cin >> znak)
lista.push_back(znak); //lista.push_front(znak);
list<char>::iterator it;
for (it = lista.begin(); it != lista.end(); it++) {
lista.insert(it, 'x');
}
for_each(lista.begin(), lista.end(), print_char); cout << endl;
for (it = lista.begin(); it != lista.end(); ) {
if (*it == 'x')
it = lista.erase(it);
else it++;
}
// char& a = lista.back();
// a = 'x';
/*list<char>::iterator it;
for (it = lista.begin(); it != lista.end(); it++)
cout << *it << ' ';
*/
for (char a : lista)
cout << a << ' ';
cout << endl;
}
list<char>::iterator ListSearch(list<char>& lista, char znak) {
list<char>::iterator it;
for (it = lista.begin(); it != lista.end(); it++) {
if (*it == znak) return it;
}
return it;
}
bool deleteNode(list<char>& lista, int numer) {
if (lista.size() < numer || numer < 1) return false;
list<char>::iterator it;
int i = 1;
for (it = lista.begin(); i < numer; it++, i++);
lista.erase(it);
return true;
}
void createSortedList(list<int>& lista, int tab[], int n) {
for (int i = 0; i < n; i++) {
list<int>::iterator it = lista.begin();
while (lista.end() != it) {
if (*it > tab[i]) {
lista.insert(it, tab[i]);
break;
}
}
if (it == lista.end()) lista.push_back(tab[i]);
}
}

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{6d03f666-7cd9-42e8-92bb-39e7e1a6afd4}</ProjectGuid>
<RootNamespace>zadanialista</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="lab_lista.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Pliki źródłowe">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Pliki nagłówkowe">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Pliki zasobów">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="lab_lista.cpp">
<Filter>Pliki źródłowe</Filter>
</ClCompile>
</ItemGroup>
</Project>