samedi 27 juin 2020

prevent hard coded numbers in C++

How may I prevent hard coded numbers in C++?

For example if I have Score+=10; In C I would do:

#define FACTOR 10
Score+=FACTOR

But In C++ my professor told we don't use #define anymore (It's a C thing and risky), So what should I use?

Aucun commentaire:

Enregistrer un commentaire