1
edit
Changes
→Programming Style
A. '''Indentation'''
* Using the 4 spaces(TAB) and inserting spaces
----
B. '''Blocks'''
<syntaxhighlight lang="cpp">
int main()
{
int name;
int first;
if (name == first)
{
cout << "name matches" << endl;
}
}
</syntaxhighlight>
----
C. '''Variable Naming'''
Variable name start with: First letter uppercase and rest are lowercase
e.g:
<syntaxhighlight lang="cpp">
int Age;
int Sex;
</syntaxhighlight>
----
Fardad's Rule
<syntaxhighlight lang="cpp">
int a; // good
int b; // good
int a, b. c; //bad
int
a; // bad
Single line blocks must be surrounded by { and }
if(whatever)
{
do this:
} // good
if(whatever) do this; //bad
if(whatever)
do this; // bad
</syntaxhighlight>
== Team Discussion ==