The Ten Most Common C++ Mistakes
Part of the C++ All-In-One For Dummies Cheat Sheet
Although many C++ programmers take measures to prevent bugs, mistakes still slip through. This list of the ten most common mistakes while writing C++ code can help both new and veteran programmers:
- You forgot to declare the variable.
- You used the wrong uppercase and lowercase letters; for example, you typed Main when you meant main.
- You used one equal sign (=) when you were supposed to use two (==), either in an ifstatement or in a for loop.
- You forgot #include <iostream> or using namespace std;.
- You dropped the laptop in the swimming pool.
- You forgot to call new and just started using the pointer anyway.
- You forgot the word public: in your classes so everything turned up private.
- You let the dog eat the remote.
- You forgot to type the parentheses when calling a function that takes no parameters.
- You forgot a semicolon, probably at the end of a class declaration.
No hay comentarios:
Publicar un comentario