Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions Lab task2/Lab task2.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?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>
<ProjectGuid>{F515F5A2-7B39-4264-8A6D-58D4741B8ACE}</ProjectGuid>
<RootNamespace>Labtask2</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>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</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 />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="node.h" />
<ClInclude Include="list.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="functions.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
33 changes: 33 additions & 0 deletions Lab task2/Lab task2.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<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>
<ClInclude Include="list.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="node.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="functions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Lab task2/Lab task2.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
219 changes: 219 additions & 0 deletions Lab task2/functions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
#include <iostream>
#include"List.h"
using namespace std;

void list::insertion()
{
node* newnode;
int num;
newnode = new node();
cout << "please enter the value you want to insert....." << endl;
cin >> num;
newnode->set(num);
newnode->setnext(nullptr);
newnode->setprev(nullptr);

cout << "Enter the choice how you want to insert the value?" << endl;
cout << " if you want to insert after location press 1\n And if you want to insert value before location press 2" << endl;
int ch;
cin >> ch;
switch (ch)
{
case 1:
if (headnode == nullptr) {
headnode = newnode;
currentnode = newnode;
}
else {
newnode->setprev(currentnode);
newnode->setnext(currentnode->getnext());
(currentnode->getnext())->setprev(newnode);
currentnode->setnext(newnode);
currentnode = newnode;
}
size++;
break;
case 2:
if (headnode == nullptr) {
headnode = newnode;
currentnode = newnode;
}
else if (currentnode!=headnode) {

newnode->setprev(currentnode->getprev());
newnode->setnext(currentnode);
(currentnode->getprev())->setnext(newnode);
currentnode->setprev(newnode);
currentnode = newnode;
}
else {
currentnode->setprev(newnode);
newnode->setnext(currentnode);
newnode->setprev(nullptr);
newnode = headnode;
newnode = currentnode;
}




size++;
break;
default:
cout << "please enter the correct choice" << endl;
break;


}
}
void list::deletion()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
if (find() == 1) {
node* temp = currentnode;
(currentnode->getprev())->setnext(currentnode->getnext());
(currentnode->getnext())->setprev(currentnode->getprev());
currentnode = currentnode->getnext();
delete temp;
}
else {
cout << "value not found" << endl;

}
}
}
void list::get()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
cout << "Current element is " << currentnode->get() << endl << "Current index is " << currentnode->getnext() << endl;
}
}
void list::start()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
currentnode = headnode;
cout << "Current element is " << currentnode->get() << endl << "Current index is " << currentnode->getnext() << endl;
}
}



void list::update()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
if (find() == 1)
{
int update;
cout << "Enter the value to be updated......!!!!!!" << endl;
cin >> update;

currentnode->set(update);
}
cout << "your value has been updated thanks!!!!!!" << endl;
}
}
void list::tail()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
while (currentnode->getnext() != nullptr) {
currentnode = currentnode->getnext();

}
cout << "you are now at the end" << endl;
}
}
void list::back()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
currentnode = currentnode->getprev();
cout << "you are now on this " << currentnode->get() << " element" << endl;
}
}
void list::next()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
currentnode = currentnode->getnext();
cout << "you are now on this " << currentnode->get() << " element" << endl;
}
}
void list::display()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
node* tem = headnode;
while (tem != nullptr)
{
cout << tem->get() << endl;
tem = tem->getnext();
}
}
}
void list::length()
{
if (headnode == nullptr) {
cout << "List is empty" << endl;
}
else {
cout << "length of list is:" << size << endl;
}
}
void list::exit()
{

}
int list::find()
{
int flag = 0;
if (headnode == nullptr) {

cout << "List is empty" << endl;

}
else {

int num;
cout << "Enter the value that you want to find" << endl;
cin >> num;
node* temp = headnode;

while (temp != nullptr)
{
if (num == temp->get())
{
currentnode = temp;

flag = 1;
break;

}
else
{
flag = 0;
}
}
}
return flag;
}
Loading