class String
{

char* words[1000];  // array of pointers to c-strings
int   n = 0;        // number of words
public :
String()
{
char  aWord[100];   // a temporary place to hold new word
while (cin >> aWord) {
    int len = strlen(aWord) + 1;    // how much space is needed
    char* newSpace = new char[len]; // allocate with new
    strcpy(newSpace, aWord);        // copy to new space
    words[n] = newSpace;            // save pointer
    n++;
}
}

~String()
{
for(int i=0;i<n;i++)
{
cout<<words[i]<<endl;
}
}
};
int main()
{
String s;
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to