_______ Karel junk

class myRobot : Robot
{
    void  faceNorth();
};

void myRobot :: faceNorth()
{ 
	while(! facingNorth()) {
        turnLeft();
    }
}

task   // note:  task instead of main !
{
    myRobot steepleChaser(1, 1, East, 0);
    steepleChaser.race();
}

_________ skip whitespace
	cin.unsetf(ios::skipws);		// unset skip whitespace
	getchar()  ??????
	
	cin.setf(ios :: ???)
	skipws  internal  hex  uppercase  scientific 
	left dec showpoint showpos showbase right oct fixed
	
_________ abs
include <stdlib.h>
abs(mInt);       // convert to absolute value

_________ PI and MAXINT
#include <values.h>
M_PI		// pi
MAXINT      // max integer

_________ sum up digits in integer
    int mInt, r, sum = 0;

    cin >> mInt;			// read number
    
    mInt = abs(mInt);       // convert to absolute value
	
	do {
		r    = mInt % 10;   // find units
		sum  = sum + r;     // add units to sum
		mInt = mInt / 10;   // divide by 10
							// (integer type will loose decimal point)
		
	} while (mInt > 0);		// loop while positive
	
	cout << sum << endl;    // print
	
_________ printing with table
	cout << setw(16) << "Circumference: " 
	     << (2 * M_PI * planetRadius) 
	     << " meters" << endl;
	     
_________ open file
int Template :: openFile()
{
	// open file		
	pInStream.open(pFileName);
	
	// ensure file exists
	if (pInStream == NULL) {					// file not found
	
		cout << pFileName << " -- Input file not found!\n";
		return -1;								// readFile failed
		
	} else {									// file OK
	
		pInStream.unsetf(ios::skipws);			// unset skip whitespace	
		
		return 0;								// readFile worked
	}
}

_________ close file
int Template :: closeFile()
{
	pInStream.close();
	return 0;									// closeFile worked
}

_________ read file
#include <fstream>
//
//  read file [pFileName]
//  counting small, large and medium words and placing into
//  pSmallWords, pLargeWords and pMediumWords respectivly.
//
int Analyzer :: readFile()
{
	char c;
	int wordLength = 0;
	
	// ready file
	ifstream inStream (pFileName);			
	
	// ensure file exists
	if (inStream == NULL) {					// file not found
	
		cout << pFileName << " -- Input file not found!\n";
		return -1;								// readFile failed
		
	} else {									// file OK
	
		inStream.unsetf(ios::skipws);			// unset skip whitespace	
		
		while (! inStream.eof() ) {
		
			inStream >> c;						// read file
			
			// new word if space or EOF
			if ( isspace(c) || inStream.eof() ) {
			
				// add word to data
				if (wordLength == 0) {
					; 							// skip 0 word length issues 
				} else {
					pWordCount[wordLength]++;	// inc wordcount array
				}
				wordLength = 0;					// reset wordLength
			} else if ( isalpha(c) ) {			
				wordLength++;					// count regular characters
				if (wordLength > MWORDSZ) {
					wordLength = MWORDSZ;		// cap the wordLength to MWORDSZ
				}
			}
		}
		
		inStream.close();						// close pFileName
	}
	
	return 0;									// readFile worked
}

_________find the largest two entries
//  find the largest two entries
//

void top2 (int nValue, int& lower, int& higher)
{
	if (nValue > higher) {
		lower  = higher;
		higher = nValue;
	} else if (nValue > lower) {
		lower = nValue;
	}
}

____ OVERLOADING, enum day, month, year
enum DayType    {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};
enum MonthType  {January, Febuary, March, April, May, June,
                 July, August, September, October, November, December};
enum SeasonType {Fall, Winter, Spring, Summer};

//
//  Overloading + operator for DayType
//  Note: this is not currently used, but I've
//        kept it here as an example
//
DayType operator+ (DayType d, int increment)
{
	d = (DayType) ( (int) d + increment );
	
	while ( (int) d >= DAYSINWEEK) {
		d = (DayType) ( (int) d - DAYSINWEEK );
	}
	
	return d;
}

______ typedef
const int YRSFROM89 = 10;
const int MONTHS    = 12;
typedef double monthlyRain[MONTHS + 1];
typedef monthlyRain year[YRSFROM89 + 1];

_______ sprintf
#include <cstdio>
	int lastPossDay;
	char vDayStr[80];					// string to hold valid day text
	sprintf(vDayStr, "Type a valid day (between 1 and %d): ", lastPossDay);
_______ round ???

_______ isspace(c)
#include <cctype>
isalpha(c)
isspace(c)
isupper(c)
isdigit(c)
c = tolower(c);
c = toupper(c);

________ strcmp
#include <cstring>
if ( strcmp(fileName, "none") == 0)

________ length(s)
int length (char a[])
{
	int i = 0;
	while(a[i])
		i++;
	return i;
}

int length2( char * a )
{
	int i = 0;
	while (*a) {
		i++; a++;
	}
	return i;
}

int length3( char * p )
{
	char * front = p;
	while(*p)
		p++;
	return (p - front);
}

int length4( char a[] )
{
	if( a[0] == '\0' )
		return 0;
	else
		return(1 + length4(&a[1]));
}

int length5( char * p )
{
	if (*p == '\0')
		return 0;
	else
		return (1 + length5(p+1));
}

______ struct
struct studentType
{
	char	name[80];
	int		scores[10];
	bool	ownsComputer;
}

_______ assigning arrays
	char aa[80] = {"hello\n"};
	char bb[]   = {"smelly\n"};
	int i[] = {1, 2, 3, 4, 5, 6, 7};
