/*----------------------------------------------------------------*/
/* This file can be saved to your machine (almost) as you see it */
/* by doing a "Save As..." from the File menu of your browser. */
/* */
/* For this to work, you must TYPE a filename with .txt as the */
/* file extent. (Simply selecting .txt as the file type */
/* doesn't seem to be sufficient.) Remove the .txt extension */
/* once the file is saved. (IE inserts the page title as the */
/* first line, which must be removed also.) */
/*----------------------------------------------------------------*/
// Author: Hannah C. Tang (hctang@cs)
//
// Test driver for the Array class
#include
<string>
using namespace std; // This statement is necessary when using STL stuff
#include
"Array.hh"
int
main( void
)
{
Array< int
> intArray( 5 ); // Create an array of ints
Array< const
char
* > stringArray( 10 ); // An array of strings
for
( int
i = 0; i < 5; i++ )
{
intArray[ i ] = i;
}
stringArray[ 0 ] = "Hello";
stringArray[ 1 ] = "darkness";
stringArray[ 2 ] = "my";
stringArray[ 3 ] = "old";
stringArray[ 4 ] = "friend";
stringArray[ 5 ] = "I've";
stringArray[ 6 ] = "come";
stringArray[ 7 ] = "to";
stringArray[ 8 ] = "talk";
stringArray[ 9 ] = "with";
// These last two should be out of bounds
stringArray[ 10 ] = "you";
stringArray[ 11 ] = "again";
return
0;
}