Open main menu

CDOT Wiki β

Changes

Team B - OOP344 20133

507 bytes added, 04:42, 19 October 2013
Coding Style and Standards
== Coding Style and Standards ==
* No Tab Character allowed. (replace tabs with spaces)* Each object must have its own typeThe following will serve as an example of our coding standard:
<big><syntaxhighlight lang="cpp">
int a;int b;CDialog D;<#ifndef __BDOT_FILENAME_H__ /syntaxhighlight></big>Our Team's Safeguard#define __BDOT_FILENAME_H__* With regards to space characters, standard will be as follows:<big><syntaxhighlight lang="cpp">if(a == b) class example { x = y * z; // 2 spaces for indentation}</syntaxhighlight></big>* With regards to classes, standard There will be as follows:<big><syntaxhighlight lang="cpp">a space after every class example {identifier for the definition
public:
int _a_data; // member Member variables should start with an underscore int _arraySize // use Use meaningful names for variables when applicable and use camel notationlower Camel Case int _width; // Every object have its own type char* _pArray; // pointers Pointers should have '*' part of the type
};
 #endif ... #include </syntaxhighlightiostream>#include <cstring>using namespace std; int main() { int a = 0; //bigIndentation is 2 spaces int b = 1; // NO Tab characters allowed! Replace every tab character with 2 spaces. char name[] = "Spoom"; // Put a newline after variable declaration if(a >b ? a : b) { a = a * For the safeguard for header filesb; // Put a space between EVERY variable and operator } // Put a newline after a control structure if(!strcmp(name, we "Spoom")) { cout << "Welcome, Spoom!" << endl; // Every statement within a control structure will use the following: } // be wrapped in braces, even if there is only 1 line else { cout <big><syntaxhighlight lang="cppGet out."><< endl; }  return 0;__BDOT_FILENAME_H__}
</syntaxhighlight></big>