feladat4 done, needs unit tests
This commit is contained in:
parent
c0886a6cc7
commit
bc87732585
7 changed files with 302 additions and 138 deletions
|
|
@ -1,8 +1,30 @@
|
|||
//Tóth Dániel Mátyás | IFPQYY | V1
|
||||
//Tóth Dániel Mátyás | IFPQYY | V1
|
||||
#include "cmydateexception.h"
|
||||
#include <iostream>
|
||||
|
||||
static int CopyStr(char* dest, const char* src, const char* concat = "\0") {
|
||||
if (dest == nullptr || src == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
int i = 0;
|
||||
while (src[i] != '\0')
|
||||
{
|
||||
dest[i++] = src[i];
|
||||
}
|
||||
int j = 0;
|
||||
while (concat[j] != '\0')
|
||||
{
|
||||
dest[i++] = concat[j++];
|
||||
}
|
||||
dest[i] = '\0';
|
||||
return -1;
|
||||
}
|
||||
|
||||
CMyDateException::CMyDateException(const char* s)
|
||||
{
|
||||
strncpy(msg, s, sizeof(s));
|
||||
CopyStr(msg, s);
|
||||
}
|
||||
|
||||
const char* CMyDateException::what() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue