Skip to content

Commit 6b8897d

Browse files
committed
Exception
Exception Task
1 parent 352d715 commit 6b8897d

10 files changed

+289
-0
lines changed

ExceptionTask/ExceptionTask.cpp

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#include <iostream>
2+
#include <windows.h>
3+
#include <vector>
4+
5+
using namespace std;
6+
7+
// Database elave olunsun
8+
void deleteUserById(const int& id);//eger bele bir id istifadechi yoxdursa exception atilsin
9+
void hashUserDataById(const int& id);//gonderilen id deki istifadechinin butun melumatlari hash olunsun(string olanlar)digerleri qalsin
10+
11+
12+
class Exception {
13+
string _message;
14+
int _line;
15+
string _source;
16+
string _time;
17+
public:
18+
Exception(string message,int line,string source,string time){
19+
//_message = (string)exception::what();
20+
_line = line;
21+
_source = source;
22+
_time = time;
23+
}
24+
25+
26+
27+
};
28+
class DatabaseException : public Exception {};
29+
class InvalidArgumentException :public Exception {};
30+
31+
32+
class User {
33+
int _id;
34+
string _username;
35+
string _password;
36+
string _name;
37+
string _surname;
38+
39+
public:
40+
void show() const;
41+
string getUsername() { return _username; }
42+
};
43+
44+
class Database {
45+
vector<User>users;
46+
public:
47+
void addUser(const User& user) {
48+
users.push_back(user);
49+
}
50+
User& getUserByUsername(string username) {
51+
for (size_t i = 0; i < users.size(); i++) {
52+
if (users[i].getUsername() == username)
53+
return users[i];
54+
}
55+
}
56+
void updateUser(User& olduser, const User& newuser) {
57+
for (size_t i = 0; i < users.size(); i++){
58+
if (users[i] == olduser)
59+
users[i] = newuser;
60+
}
61+
}
62+
};
63+
64+
65+
66+
class Registration {
67+
Database _database;
68+
public:
69+
Registration(const Database& database) {
70+
_database = database;
71+
}
72+
73+
74+
//eger bu username istifadechi yoxdursa error atsin
75+
//eger username varsa amma password yanlishdirsa error atsin
76+
void signIn(string username, string password);
77+
78+
79+
//Eger istifadechi varsa hemen username de throw DatabaseException
80+
//Eger username xarakter sayi 6 dan kichikdirse InvalidArgumentException
81+
//Eger username ilk herf kichikdirse InvalidArgumentException
82+
//Eger password xarakter sayi 6 dan kichikdirse InvalidArgumentException
83+
//Eger name xarakter sayi 3 dan kichikdirse InvalidArgumentException
84+
//Eger surname xarakter sayi 4 dan kichikdirse InvalidArgumentException
85+
void signUp(string username, string password, string name, string surname);
86+
};
87+
88+
89+
class StartUp {
90+
public:
91+
static void Start() {
92+
Database db;
93+
Registration twitter(db);
94+
95+
// twitter.getDatabase().addUser(user);
96+
97+
//mainde yazilacaq her shey burda yazilsin.
98+
}
99+
100+
101+
102+
103+
};
104+
105+
106+
107+
void main() {
108+
StartUp::Start();
109+
110+
111+
system("pause");
112+
}

ExceptionTask/ExceptionTask.vcxproj

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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>{6e531c3c-e58b-496d-a63a-60b9221c85e0}</ProjectGuid>
25+
<RootNamespace>ExceptionTask</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="ExceptionTask.cpp" />
131+
</ItemGroup>
132+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
133+
<ImportGroup Label="ExtensionTargets">
134+
</ImportGroup>
135+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="ExceptionTask.cpp">
19+
<Filter>Kaynak Dosyalar</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>
+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>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
 ExceptionTask.cpp
2+
C:\Users\LEGION\source\repos\ExceptionTask\ExceptionTask\ExceptionTask.cpp(58,1): error C2678: ikili '==': '_Ty' türünde bir sol taraf işleneni alan hiçbir işleç bulunamadı (veya hiç kabul edilebilir dönüştürme yok)
3+
with
4+
[
5+
_Ty=User
6+
]
7+
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\guiddef.h(192,15): message : 'bool operator ==(const GUID &,const GUID &)' olabilirdi
8+
C:\Users\LEGION\source\repos\ExceptionTask\ExceptionTask\ExceptionTask.cpp(58,1): message : '(_Ty, User)' bağımsız değişken listesi eşlenmeye çalışılırken
9+
with
10+
[
11+
_Ty=User
12+
]
13+
C:\Users\LEGION\source\repos\ExceptionTask\ExceptionTask\ExceptionTask.cpp(107,13): warning C4326: 'main' öğesinin dönüş türü 'int' olmalıdır, 'void' değil
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:
2+
Debug|x64|C:\Users\LEGION\source\repos\ExceptionTask\|

ExceptionTask/x64/Debug/ExceptionTask.tlog/unsuccessfulbuild

Whitespace-only changes.

ExceptionTask/x64/Debug/vc143.idb

40.5 KB
Binary file not shown.

ExceptionTask/x64/Debug/vc143.pdb

230 KB
Binary file not shown.

0 commit comments

Comments
 (0)