Skip to content

Commit 44c7403

Browse files
committed
Debtor
Debtor Task in C++
1 parent e6f79ef commit 44c7403

18 files changed

+389
-0
lines changed

Debtor/Debtor.cpp

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#include <iostream>
2+
#include <vector>
3+
#include <algorithm>
4+
#include <list>
5+
#include <numeric>
6+
using namespace std;
7+
#include "Debtor.h"
8+
9+
void ageBetween(const Debtor & debtor){
10+
if ((debtor.getBirthday().year) <= 1996 && (debtor.getBirthday().year) >= 1986)
11+
cout << debtor << endl;
12+
}
13+
void debtMoreThan500(const Debtor& debtor){
14+
if (debtor.getDebt()< 5000)
15+
cout << debtor << endl;
16+
}
17+
18+
void nameUpper18andTwo7numberinPhone(const Debtor& debtor) {
19+
int count7 = 0;
20+
for (size_t i = 0; i < debtor.getPhone().size(); i++) {
21+
if (debtor.getPhone()[i] == '7')
22+
count7++;
23+
if (debtor.getFullname().size() >= 18 && count7 >= 2) {
24+
cout << debtor << endl;
25+
break;
26+
}
27+
}
28+
}
29+
30+
void sawSecondWorldWar(const Debtor& debtor) {
31+
if (debtor.getBirthday().year >= 1939 && debtor.getBirthday().year <= 1945)
32+
cout << debtor << endl;
33+
}
34+
35+
void bornInWinter(const Debtor& debtor) {
36+
if (debtor.getBirthday().month == 1 || debtor.getBirthday().month == 2 || debtor.getBirthday().month == 12)
37+
cout << debtor << endl;
38+
}
39+
int main(){
40+
vector<Debtor> debtors;
41+
debtors.push_back(Debtor("Shirley T. Qualls", DateTime(30,3,2000), "530-662-7732", "ShirleyTQualls@teleworm.us", "3565 Eagles Nest Drive Woodland, CA 95695", 2414));
42+
debtors.push_back(Debtor("Danielle W. Grier", DateTime(18, 10, 1978), "321-473-4178", "DanielleWGrier@rhyta.com", "1973 Stoneybrook Road Maitland, FL 32751", 3599));
43+
debtors.push_back(Debtor("Connie W. Lemire", DateTime(18, 7, 1963), "828-321-3751", "ConnieWLemire@rhyta.com", "2432 Hannah Street Andrews, NC 28901", 1219));
44+
debtors.push_back(Debtor("Coy K. Adams", DateTime(1, 13, 1976), "410-347-1307", "CoyKAdams@dayrep.com", "2411 Blue Spruce Lane Baltimore, MD 21202", 3784));
45+
debtors.push_back(Debtor("Bernice J. Miles", DateTime(1, 6, 1988), "912-307-6797", "BerniceJMiles@armyspy.com", "4971 Austin Avenue Savannah, GA 31401", 4060));
46+
debtors.push_back(Debtor("Bob L. Zambrano", DateTime(28, 2, 1990), "706-446-1649", "BobLZambrano@armyspy.com", "2031 Limer Street Augusta, GA 30901", 6628));
47+
debtors.push_back(Debtor("Adam D. Bartlett", DateTime(6, 5, 1950), "650-693-1758", "AdamDBartlett@rhyta.com", "2737 Rardin Drive San Jose, CA 95110", 5412));
48+
debtors.push_back(Debtor("Pablo M. Skinner", DateTime(26, 8, 1936), "630-391-2034", "PabloMSkinner@armyspy.com", "16 Fraggle Drive Hickory Hills, IL 60457", 11097));
49+
debtors.push_back(Debtor("Dorothy J. Brown", DateTime(9, 7, 1971), "270-456-3288", "DorothyJBrown@rhyta.com", "699 Harper Street Louisville, KY 40202", 7956));
50+
debtors.push_back(Debtor("Larry A. Miracle", DateTime(22, 5, 1998), "301-621-3318", "LarryAMiracle@jourrapide.com", "2940 Adams Avenue Columbia, MD 21044", 7150));
51+
debtors.push_back(Debtor("Donna B. Maynard", DateTime(26, 1, 1944), "520-297-0575", "DonnaBMaynard@teleworm.us", "4821 Elk Rd Little Tucson, AZ 85704", 2910));
52+
debtors.push_back(Debtor("Jessica J. Stoops", DateTime(22, 4, 1989), "360-366-8101", "JessicaJStoops@dayrep.com", "2527 Terra Street Custer, WA 98240", 11805));
53+
debtors.push_back(Debtor("Audry M. Styles", DateTime(7, 2, 1937), "978-773-4802", "AudryMStyles@jourrapide.com", "151 Christie Way Marlboro, MA 01752", 1001));
54+
debtors.push_back(Debtor("Violet R. Anguiano", DateTime(4, 11, 1958), "585-340-7888", "VioletRAnguiano@dayrep.com", "1460 Walt Nuzum Farm Road Rochester, NY 14620", 9128));
55+
debtors.push_back(Debtor("Charles P. Segundo", DateTime(21, 11, 1970), "415-367-3341", "CharlesPSegundo@dayrep.com", "1824 Roosevelt Street Fremont, CA 94539", 5648));
56+
debtors.push_back(Debtor("Paul H. Sturtz", DateTime(15, 9, 1944), "336-376-1732", "PaulHSturtz@dayrep.com", "759 Havanna Street Saxapahaw, NC 27340", 10437));
57+
debtors.push_back(Debtor("Doris B. King", DateTime(10, 10, 1978), "205-231-8973", "DorisBKing@rhyta.com", "3172 Bedford Street Birmingham, AL 35203", 7230));
58+
debtors.push_back(Debtor("Deanna J. Donofrio", DateTime(16, 4, 1983), "952-842-7576", "DeannaJDonofrio@rhyta.com", "1972 Orchard Street Bloomington, MN 55437", 515));
59+
debtors.push_back(Debtor("Martin S. Malinowski", DateTime(17,1, 1992), "765-599-3523", "MartinSMalinowski@dayrep.com", "3749 Capitol Avenue New Castle, IN 47362", 1816));
60+
61+
cout << "------------3)Yashi 26 - dan 36 - ya qeder olan borclulari cixartmag------------" << endl;
62+
//lambda
63+
for_each(debtors.begin(), debtors.end(), [](const Debtor& debtor) {
64+
if ((debtor.getBirthday().year) <= 1996 && (debtor.getBirthday().year) >=1986)
65+
cout << debtor << endl;
66+
});
67+
68+
//Predicate
69+
for_each(debtors.begin(), debtors.end(), ageBetween);
70+
71+
cout << "------------4) Borcu 5000 - den cox olmayan borclularic cixartmag------------" << endl;
72+
//lambda
73+
for_each(debtors.begin(), debtors.end(), [](const Debtor& debtor) {
74+
if (debtor.getDebt() < 5000)
75+
cout << debtor << endl;
76+
});
77+
//Predicate
78+
for_each(debtors.begin(), debtors.end(), debtMoreThan500);
79+
80+
cout << "------------5) Butov adi 18 simvoldan cox olan ve telefon nomresinde 2 ve ya 2-den cox 7 reqemi olan borclulari cixartmaq------------" << endl;
81+
//lambda
82+
for_each(debtors.begin(), debtors.end(), [&](const Debtor& debtor) {
83+
int count7 = 0;
84+
for (size_t i = 0; i < debtor.getPhone().size(); i++){
85+
if (debtor.getPhone()[i] == '7')
86+
count7++;
87+
if (debtor.getFullname().size() >= 18 && count7 >= 2) {
88+
cout << debtor << endl;
89+
break;
90+
}
91+
}
92+
});
93+
//Predicate
94+
95+
96+
for_each(debtors.begin(), debtors.end(), nameUpper18andTwo7numberinPhone);
97+
cout << "------------7) Qishda anadan olan borclulari cixardmaq------------" << endl;
98+
//lambda
99+
for_each(debtors.begin(), debtors.end(), [](const Debtor& debtor) {
100+
if (debtor.getBirthday().month == 1 || debtor.getBirthday().month == 2 || debtor.getBirthday().month == 12)
101+
cout << debtor << endl;
102+
});
103+
//predicate
104+
105+
for_each(debtors.begin(), debtors.end(), bornInWinter);
106+
107+
cout << "------------15) Butun borcu olanlarin borcunu cemleyib umumi borcu cixartmaq------------" << endl;
108+
//lambda
109+
auto sum = accumulate(debtors.begin(), debtors.end(), 0, [](float result, const Debtor& debtor) {
110+
result += debtor.getDebt();
111+
return result;
112+
});
113+
114+
cout << "Sum: " << sum << endl;
115+
//Predicate
116+
117+
118+
cout << "------------16) 2ci dunya muharibesin gormush borclularin siyahisi cixartmaq------------" << endl;
119+
for_each(debtors.begin(), debtors.end(), [](const Debtor& debtor) {
120+
if (debtor.getBirthday().year >= 1939 && debtor.getBirthday().year<= 1945)
121+
cout << debtor << endl;
122+
});
123+
124+
125+
for_each(debtors.begin(), debtors.end(), sawSecondWorldWar);
126+
127+
128+
129+
130+
131+
132+
133+
134+
135+
}
136+

Debtor/Debtor.h

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#pragma once
2+
struct DateTime {
3+
short day;
4+
short month;
5+
short year;
6+
DateTime() = default;
7+
DateTime(short day,short month,short year){
8+
this->day;
9+
this->month;
10+
this->year;
11+
}
12+
};
13+
14+
class Debtor {
15+
string _fullName;
16+
DateTime _birthday;
17+
string _phone;
18+
string _email;
19+
string _address;
20+
int _debt;
21+
22+
public :
23+
Debtor() = default;
24+
Debtor(string fullName, DateTime birthDay, string phone, string email, string address, int debt) {
25+
this->_fullName = fullName;
26+
this->_birthday = birthDay;
27+
this->_phone = phone;
28+
this->_email = email;
29+
this->_address= address;
30+
this->_debt= debt;
31+
}
32+
33+
string getFullname() const { return _fullName; }
34+
DateTime getBirthday() const{ return _birthday; }
35+
string getPhone()const { return _phone; }
36+
string getEmail() const { return _email; }
37+
string getAddress() const { return _address; }
38+
int getDebt() const { return _debt; }
39+
40+
41+
friend ostream& operator<<(ostream& out, const Debtor& debtor);
42+
};
43+
ostream& operator<<(ostream& output, const Debtor& debtor){
44+
cout << "Full name: " << debtor._fullName << endl;
45+
cout << "Birthday: " << debtor._birthday.day << '.' << debtor._birthday.month << '.' << debtor._birthday.year << endl;
46+
cout << "Phone: " << debtor._phone << endl;
47+
cout << "Email: " << debtor._email << endl;
48+
cout << "Address: " << debtor._address << endl;
49+
cout << "Debt: " << debtor._debt << endl;
50+
return output;
51+
}

Debtor/Debtor.vcxproj

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{9966da55-7677-449e-999a-592d85f6bc07}</ProjectGuid>
25+
<RootNamespace>Debtor</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v143</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v143</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v143</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v143</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<ClCompile>
75+
<WarningLevel>Level3</WarningLevel>
76+
<SDLCheck>true</SDLCheck>
77+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
78+
<ConformanceMode>true</ConformanceMode>
79+
</ClCompile>
80+
<Link>
81+
<SubSystem>Console</SubSystem>
82+
<GenerateDebugInformation>true</GenerateDebugInformation>
83+
</Link>
84+
</ItemDefinitionGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
86+
<ClCompile>
87+
<WarningLevel>Level3</WarningLevel>
88+
<FunctionLevelLinking>true</FunctionLevelLinking>
89+
<IntrinsicFunctions>true</IntrinsicFunctions>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
</ClCompile>
94+
<Link>
95+
<SubSystem>Console</SubSystem>
96+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
97+
<OptimizeReferences>true</OptimizeReferences>
98+
<GenerateDebugInformation>true</GenerateDebugInformation>
99+
</Link>
100+
</ItemDefinitionGroup>
101+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
102+
<ClCompile>
103+
<WarningLevel>Level3</WarningLevel>
104+
<SDLCheck>true</SDLCheck>
105+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106+
<ConformanceMode>true</ConformanceMode>
107+
</ClCompile>
108+
<Link>
109+
<SubSystem>Console</SubSystem>
110+
<GenerateDebugInformation>true</GenerateDebugInformation>
111+
</Link>
112+
</ItemDefinitionGroup>
113+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
114+
<ClCompile>
115+
<WarningLevel>Level3</WarningLevel>
116+
<FunctionLevelLinking>true</FunctionLevelLinking>
117+
<IntrinsicFunctions>true</IntrinsicFunctions>
118+
<SDLCheck>true</SDLCheck>
119+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
120+
<ConformanceMode>true</ConformanceMode>
121+
</ClCompile>
122+
<Link>
123+
<SubSystem>Console</SubSystem>
124+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
125+
<OptimizeReferences>true</OptimizeReferences>
126+
<GenerateDebugInformation>true</GenerateDebugInformation>
127+
</Link>
128+
</ItemDefinitionGroup>
129+
<ItemGroup>
130+
<ClCompile Include="Debtor.cpp" />
131+
</ItemGroup>
132+
<ItemGroup>
133+
<ClInclude Include="Debtor.h" />
134+
</ItemGroup>
135+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
136+
<ImportGroup Label="ExtensionTargets">
137+
</ImportGroup>
138+
</Project>

Debtor/Debtor.vcxproj.filters

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Kaynak Dosyalar">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Üst Bilgi Dosyaları">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Kaynak Dosyaları">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="Debtor.cpp">
19+
<Filter>Kaynak Dosyalar</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClInclude Include="Debtor.h">
24+
<Filter>Kaynak Dosyalar</Filter>
25+
</ClInclude>
26+
</ItemGroup>
27+
</Project>

Debtor/Debtor.vcxproj.user

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

Debtor/x64/Debug/Debtor.exe.recipe

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
<ProjectOutputs>
4+
<ProjectOutput>
5+
<FullPath>C:\Users\LEGION\source\repos\Debtor\x64\Debug\Debtor.exe</FullPath>
6+
</ProjectOutput>
7+
</ProjectOutputs>
8+
<ContentFiles />
9+
<SatelliteDlls />
10+
<NonRecipeFileRefs />
11+
</Project>

Debtor/x64/Debug/Debtor.ilk

1000 KB
Binary file not shown.

Debtor/x64/Debug/Debtor.log

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
 Debtor.cpp
2+
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\numeric(34,27): warning C4244: 'bağımsız değişken': '_Ty' - 'float' dönüşümü; veri kaybı olabilir
3+
with
4+
[
5+
_Ty=int
6+
]
7+
C:\Users\LEGION\source\repos\Debtor\Debtor\Debtor.cpp(112): message : derlenen şablon işlevi '_Ty std::accumulate<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<Debtor>>>,int,main::<lambda_5>>(const _InIt,const _InIt,_Ty,_Fn)' örneği oluşturma başvurusuna bakın
8+
with
9+
[
10+
_Ty=int,
11+
_InIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<Debtor>>>,
12+
_Fn=main::<lambda_5>
13+
]
14+
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include\numeric(34,26): warning C4244: '=': 'float' - '_Ty' dönüşümü; veri kaybı olabilir
15+
with
16+
[
17+
_Ty=int
18+
]
19+
Debtor.vcxproj -> C:\Users\LEGION\source\repos\Debtor\x64\Debug\Debtor.exe
738 Bytes
Binary file not shown.
20.1 KB
Binary file not shown.
500 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)