Principles of Computer Science II

312-174

Style Guide

This guide is designed to demonstrate the format that your programs should take. Below are examples for functions, class declarations, class definitions, programs, etc. You should use this guide for all labs and projects.

Function Style


//-----------------------------------------------------------------------
//  Function:  functionName
//  Purpose:  The purpose of the function.
//  Preconditions: 		
//  Postconditions:
//  Return as value of function:  Return value.
//-----------------------------------------------------------------------

Program Style


//-----------------------------------------------------------------------
//  Program:  programName
//
// Specifications for the Program programName:
//
// Programer(s):
//
// Date last modified:
//
//  Purpose:  	The purpose of the Program.
//-----------------------------------------------------------------------

#include <            >

//-----------------------------------------------------------------------
//  Global Constants and TypedefÕs
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//  Function Prototypes
//-----------------------------------------------------------------------


Class Style


//-----------------------------------------------------------------------
//
// Programer:
//
// Date:
//
//
// Header file:		example.h
//
// Implmentation file:		example.cpp
//
// Specifications for the class Word
//
// Purpose of class:
//	A word object represents information about words.  These
//	can be used in any application requiring the use of strings.
// 	A word consists of any combination of letters and numbers but 
//	cannot include spaces or special characters.
//-----------------------------------------------------------------------

#include <            >

//-----------------------------------------------------------------------
//  Global Constants and TypedefÕs
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// Global Function Prototypes
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// Member Variable declarations
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//  Interface for Word constructor:  Word::Word()
//  Given:		nothing;  
//  Return:	A word object;
//  Return as value of function:  Nothing;
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
//  Interface for Word destructor:  Word::~Word()
//  Given:		An initialized word object;
//  Return:	Deallocated object;
//  Return as value of function:  
//-----------------------------------------------------------------------

// Public data/function members

	// Constructor/Destructor functions.

	// Access Member Functions.

	// Modification Member Functions.

	//  Comparision Operators.

// Private data/function members

	// Facilitator functions
	
	// Private Data members

	

Return to Student Pages

Return to John Barr's Home Page

Last Modified: 9 January 2000

THIS PAGE MAINTAINED BY:
John Barr, Ithaca College