Honor Code Acknowledgment: _____________________________
Due: Monday, June 28, 1999 6 points
void DoStuff(Vector <string *> wp, int n )
// precondition: ????
// postcondition: ????
{
int k;
for (k = n; k >= 0; k--)
{
cout << *wp[k] << endl;
delete wp[k];
}
}
int main()
{
Vector <string *> wordp(1000);
string s;
cout << "Enter strings (^ D to quit)" << endl;
int k = 0;
wordp[k] = new string;
while (cin >> *wordp[k])
{
k++;
wordp[k] = new string;
}
delete wordp[k];
DoStuff(wordp, k-1);
return 0;
}
What would be good pre and post conditions for the DoStuff function?
Given the following data, what would be the output of this program?
goose solder lightbulb carpet wookie pigeon Peppercorn phonebook
Why is the line "delete wordp[k];" in the main function of the above
program?