fix: bunch of meaningless chars in the walkthrough/source code

level9: done (wip - walkthrough)
This commit is contained in:
0x35c
2025-05-05 18:00:54 +02:00
parent 50afa069df
commit 428102a376
5 changed files with 49 additions and 4 deletions

44
level9/source.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <cstring>
#include <stdlib.h>
class N
{
public:
char annotation[100];
int nb;
N(int Nb)
{
nb = Nb;
}
void setAnnotation(char *str)
{
memcpy(annotation, str, strlen(str));
}
int operator+(N const &e)
{
return nb + e.nb;
}
int operator-(N const &e)
{
return nb - e.nb;
}
};
int main(int ac, char **av)
{
if (ac <= 1)
exit(1);
N *a = new N(5);
N *b = new N(6);
N *a_ptr = a;
N *b_ptr = b;
a_ptr->setAnnotation(av[1]);
return *b_ptr + *a_ptr;
}