There are some universal code convention for coding known as Dr. P’s Prescription for coding. Basically these are useful for C, Java, C++, C# and many other language too.
Use parentheses to make expressions readable.
Use one statement to a line, except very short statements that a re-conceptually related, which can be on the same line. A compound statement brace comes on the same line as its controlling condition. Its matching terminating brace is lined up under the initial letter of the keyword starting the statement. A function body is a compound statement and starts on its own line.
Everything after the opening (left) brace is indented a standard number of spaces— for example, as in this text, three spaces. The matching, closing (right) brace causes subsequent statements to be lined up under it.
Global statements or declarations start in column 1.
For readability, a space is added after each token, except for the semicolon and un-ary operators.
Declarations at the head of a block are followed by a blank line.
Parenthesize the return expression whenever it is not a simple expression.
The return from main() of the integer constant 0 is considered implicit. The practice of explicitly returning 0—or not—is discretionary.
To detect errors, include a default in the switch statement, even when all the expected cases have been accounted for.
Avoid side-effect operators, such as ++, in complex expressions, unless they are used in a known idiomatic style.
Use prefix increment and prefix decrement in preference to post fix when either can be used.
Avoid casting expressions.
When possible, use the break or continue statement, rather than a goto.
Source: Ira Pohl’s C++ by Dissection
Posted by Md. Shahjalal 
