Do not use the standard namespace library, especially in header files.
using namespace std; THIS IS WRONG!!!
void function()
{
std::cout << "Hello" << std::endl;
}
After each statement (if, for, foreach, switch, etc), the brackets must always go in new line.
Examples:
if (...)
{
// code goes here...
}
for (...)
{
// code goes here...
}
switch (...)
{
// code goes here...
}
if (...)
{
// code goes here...
}
Every variable should use the camel case naming convention.
class Example
{
private:
int camelCaseExample;
public:
Example() {};
}
int main()
{
int camelCaseExample = 1;
return 0;
}
Class names should follow the upper camel case naming convention.
class ExampleClass
{
}
class exampleClass
{
}
class example_class
{
}
class exampleclass
{
}
Classes must be separated into different .h and .cpp files.
Header files must not contain any implementation just the header of the functions and the variable declarations.
int main()
{
int camelCaseExample = 1;
return 0;
}
int main()
{
int camelCaseExample = 1;
return 0;
}
Function names should always use the snakecase naming convention.
Example:
void snake_case_example_function()
{
// Function body
}