|
|
 |
|
|
|
|
249: myOtherFunction(ListOfData);
250:
251: // now walk the list and show the Object
252: cout << \n ;
253: ListOfCats.ShowAll();
254: cout << \n ;
255: ListOfData.ShowAll();
256: cout << \n ************ \n\n ;
257: return 0; // The lists fall out of scope and are // destroyed!
258: }
259:
260: void myFunction(LinkedList<Cat>& ListOfCats)
261: {
262: Cat * pCat;
263: int val;
264:
265: // ask the user to produce some values
266: // put them in the list
267: for (;;)
268: {
269: cout << \nHow old is your cat? (0 to stop): ;
270: cin >> val;
271: if (!val)
272: break;
273: pCat = new Cat(val);
274: ListOfCats.Insert(pCat);
275: }
276:
277: }
278:
279: void myOtherFunction(LinkedList<Data>& ListOfData)
280: {
281: Data * pData;
282: int val;
283:
284: // ask the user to produce some values
285: // put them in the list
286: for (;;)
287: {
288: cout << \nWhat value? (0 to stop): ;
289: cin >> val;
290: if (!val)
291: break;
292: pData = new Data(val);
293: ListOfData.Insert(pData);
294: }
295:
296: } |
|
|
|
|
|