Vector_demo

Vector_demo - /* An Example Using The Vector Class */ /* An...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/*** An Example Using The Vector Class ***/ /*** An example program illustrating the functionality of the Vector class ***/ #include <fstream> #include "Vector.h" #include "MyString.h" using namespace std; ofstream output; void main () { output.open("demo_Vector.out"); // Create two String objects. String item1("CS XXX"), item2("Course Material"); // USING THE DEFAULT CONSTRUCTOR output << "Create array1, an empty Vector object with a default" << endl << "storage capacity = 10, using the default" << " constructor." << endl << endl; Vector<String> array1; // USING AddLast FUNCTION output << "Demonstrating AddLast, a useful member function, which" << endl << "adds a given item as the last item of the" << endl << "sequence." << endl << endl << "Add one after another the following four string objects" << endl << "to array1 using the AddLast function. " << endl << "\"CS XXX\",\"Course Material\",\"Using\",\"Vectors\"." <<endl; array1.AddLast(item1); array1.AddLast(item2); array1.AddLast("Using");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/07/2008 for the course CS 181 taught by Professor Satya during the Fall '08 term at Stevens.

Page1 / 4

Vector_demo - /* An Example Using The Vector Class */ /* An...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online