diff --git a/feladat4/UnitTest1/UnitTest1.cpp b/feladat4/UnitTest1/UnitTest1.cpp new file mode 100644 index 0000000..bb39223 --- /dev/null +++ b/feladat4/UnitTest1/UnitTest1.cpp @@ -0,0 +1,17 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#include "pch.h" +#include "CppUnitTest.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace UnitTest1 +{ + TEST_CLASS(UnitTest1) + { + public: + + TEST_METHOD(TestMethod1) + { + } + }; +} diff --git a/feladat4/UnitTest1/UnitTest1.vcxproj b/feladat4/UnitTest1/UnitTest1.vcxproj new file mode 100644 index 0000000..d448e6d --- /dev/null +++ b/feladat4/UnitTest1/UnitTest1.vcxproj @@ -0,0 +1,190 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 18.0 + {5768658D-5753-57BE-9F55-89088097DC31} + Win32Proj + UnitTest1 + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v145 + Unicode + false + + + DynamicLibrary + false + v145 + true + Unicode + false + + + DynamicLibrary + true + v145 + Unicode + false + + + DynamicLibrary + false + v145 + true + Unicode + false + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + true + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Create + Create + Create + Create + + + + + + + + + {e8886623-03f8-424c-becd-f95c36ad1f1b} + + + + + + \ No newline at end of file diff --git a/feladat4/UnitTest1/UnitTest1.vcxproj.filters b/feladat4/UnitTest1/UnitTest1.vcxproj.filters new file mode 100644 index 0000000..f041cae --- /dev/null +++ b/feladat4/UnitTest1/UnitTest1.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/feladat4/UnitTest1/pch.cpp b/feladat4/UnitTest1/pch.cpp new file mode 100644 index 0000000..64b7eef --- /dev/null +++ b/feladat4/UnitTest1/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/feladat4/UnitTest1/pch.h b/feladat4/UnitTest1/pch.h new file mode 100644 index 0000000..9d715b0 --- /dev/null +++ b/feladat4/UnitTest1/pch.h @@ -0,0 +1,12 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here + +#endif //PCH_H diff --git a/feladat4/feladat4.slnx b/feladat4/feladat4.slnx new file mode 100644 index 0000000..17bc585 --- /dev/null +++ b/feladat4/feladat4.slnx @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/feladat4/feladat4/cmydate.cpp b/feladat4/feladat4/cmydate.cpp new file mode 100644 index 0000000..1e9a73e --- /dev/null +++ b/feladat4/feladat4/cmydate.cpp @@ -0,0 +1,119 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#include +#include "cmydateexception.h" +#include "cmydate.h" +using namespace std; + +static bool IsLeapYear(int year); + +CMyDate::CMyDate() { + m_iYear = 1970; + m_iMonth = 1; + m_iDay = 1; +} +CMyDate::CMyDate(int year, int month, int day) { + if (!IsValid(year, month, day)) + { + throw new exception; // rewrite to correct exception + } + m_iYear = year; + m_iMonth = month; + m_iDay = day; +} +CMyDate::~CMyDate(){ + //hey jimmy, get me a desctructor with nothing +} +void CMyDate::Display() const { +} +int CMyDate::DayOfTheYear() const { +} +bool CMyDate::IsValid(int year, int month, int day) const { + if (year < 1970) + { + return false; + } + if (month < 1 || month > 12) + { + return false; + } + if (day < 1) + { + return false; + } + switch (month) + { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + if (day > 31) + { + return false; + } + break; + case 4: + case 6: + case 9: + case 11: + if (day > 30) + { + return false; + } + break; + case 2: + if (day > 29 || (day > 28 && !IsLeapYear(year))) + { + return false; + } + break; + default: + break; + } + return true; +} +void CMyDate::AddDays(int days) { +} +int CMyDate::SubDays(int days) { +} +int CMyDate::DifferenceInDays(const CMyDate& other) const { +} +void CMyDate::AddMonths(int months) { +} +int CMyDate::GetDay() const { + return m_iDay; +} +int CMyDate::GetMonth() const { + return m_iMonth; +} +int CMyDate::GetYear() const { + return m_iYear; +} +void CMyDate::SetDay(int day) { + if (IsValid(m_iYear, m_iMonth, day)) + { + m_iDay = day; + } +} +void CMyDate::SetMonth(int month) { + if (IsValid(m_iYear, month, m_iDay)) + { + m_iMonth = month; + } +} +void CMyDate::SetYear(int year) { + if (IsValid(year, m_iMonth, m_iDay)) + { + m_iYear = year; + } +} + +static bool IsLeapYear(int year) { + if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) + { + return true; + } + return false; +} \ No newline at end of file diff --git a/feladat4/feladat4/cmydate.h b/feladat4/feladat4/cmydate.h new file mode 100644 index 0000000..90c090d --- /dev/null +++ b/feladat4/feladat4/cmydate.h @@ -0,0 +1,25 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#pragma once +class CMyDate { +public: + CMyDate(); + CMyDate(int year, int month, int day); + ~CMyDate(); + void Display() const; + int DayOfTheYear() const; + bool IsValid(int year, int month, int day) const; + void AddDays(int days); + int SubDays(int days); + int DifferenceInDays(const CMyDate& other) const; + void AddMonths(int months); + int GetDay() const; + int GetMonth() const; + int GetYear() const; + void SetDay(int day); + void SetMonth(int month); + void SetYear(int year); +private: + int m_iDay; + int m_iMonth; + int m_iYear; +}; diff --git a/feladat4/feladat4/cmydateexception.cpp b/feladat4/feladat4/cmydateexception.cpp new file mode 100644 index 0000000..51e8d13 --- /dev/null +++ b/feladat4/feladat4/cmydateexception.cpp @@ -0,0 +1 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 \ No newline at end of file diff --git a/feladat4/feladat4/cmydateexception.h b/feladat4/feladat4/cmydateexception.h new file mode 100644 index 0000000..0b3d20a --- /dev/null +++ b/feladat4/feladat4/cmydateexception.h @@ -0,0 +1,2 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#pragma once diff --git a/feladat4/feladat4/feladat4.cpp b/feladat4/feladat4/feladat4.cpp new file mode 100644 index 0000000..e159638 --- /dev/null +++ b/feladat4/feladat4/feladat4.cpp @@ -0,0 +1,2 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#include "feladat4.h" \ No newline at end of file diff --git a/feladat4/feladat4/feladat4.h b/feladat4/feladat4/feladat4.h new file mode 100644 index 0000000..0b3d20a --- /dev/null +++ b/feladat4/feladat4/feladat4.h @@ -0,0 +1,2 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#pragma once diff --git a/feladat4/feladat4/feladat4.vcxproj b/feladat4/feladat4/feladat4.vcxproj new file mode 100644 index 0000000..37436df --- /dev/null +++ b/feladat4/feladat4/feladat4.vcxproj @@ -0,0 +1,153 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 18.0 + Win32Proj + {e8886623-03f8-424c-becd-f95c36ad1f1b} + feladat4 + 10.0 + + + + Application + true + v145 + Unicode + + + Application + false + v145 + true + Unicode + + + Application + true + v145 + Unicode + + + Application + false + v145 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + stdcpp20 + + + Console + true + + + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/feladat4/feladat4/feladat4.vcxproj.filters b/feladat4/feladat4/feladat4.vcxproj.filters new file mode 100644 index 0000000..101fda4 --- /dev/null +++ b/feladat4/feladat4/feladat4.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/feladat4/feladat4/main.cpp b/feladat4/feladat4/main.cpp new file mode 100644 index 0000000..bdf6b87 --- /dev/null +++ b/feladat4/feladat4/main.cpp @@ -0,0 +1,6 @@ +//Tóth Dániel Mátyás | IFPQYY | V1 +#include "feladat4.h" + +int main() { + return 0; +} \ No newline at end of file