fix: bunch of meaningless chars in the walkthrough/source code
level9: done (wip - walkthrough)
This commit is contained in:
44
level9/source.cpp
Normal file
44
level9/source.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user