Based on this
Following Google C++ sytle guide
| element | naming convention | example |
|---|---|---|
| class | PascalCase | ClassName |
| function | PacalCase | BubbleSort() |
| variable | snake_case | my_variable |
Name never start with digit.
Can’t use a predefined keyword.
User defined class and function use PacalCase
LinkedListorBubbleSort()
Variable uses snake_case
student_idorresult
{}:
():
( and after )) onlyExample:
int GetLargerNumber(int num_one, int num_two) {
if (num_one > num_two) {
return num_one;
}
else {
return num_two;
}
}
string message = "hello world";
#include <iostream> // preprocessor directive
float pi = 3.1415; // global variable
class MyClass { // class
public:
myClass() {
}
};
int main() { // function
return 0;
}
Each new block (loop, method…) opening should be intended.
Level of indentation: ?? (2 or 4)