Harvey Mudd College
2000 - 2001
Computer Science Clinic Project
sponsored by Yahoo!, Inc.
Style Guidelines
File Names
- Use file names like
MyClass.hpp
and MyClass.cpp.
Header Files
- #ifndef __MY_CLASS_H__
#define __MY_CLASS_H__
#include <system1>
#include <system2>
#include "custom1"
#include "custom2"
class MyClass
{
private:
int int_name;
protected:
int* int_ptr_name;
public:
// Write function description here.
//
void FunctionName(char* char_name);
// You can even use a multi-
// line description if you
// need to.
//
int AnotherFunctionName(int i);
};
#endif
Class Files
#include "MyClass.hpp"
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
void MyClass::FunctionName(char* char_name)
{
if (char_name == NULL)
int_name = 0;
else
int_name = 1;
return;
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
int MyClass::AnotherFunctionName(int i)
{
if (i > 0)
{
while (i-- != 0)
int_name--;
return 1;
}
else
return 0;
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
Notes
- Format for 80 characters wide.
- Slashes seperating functions are 60 characters wide.
- Indent 2 spaces at each level.