

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The implementation of a c++ template list, where each element in the list is a custom class consisting of an integer and a string. The document demonstrates how to create and add items to the list, as well as displaying the list's contents.
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


c:\documents and settings\usman.younis\my ...\TemplateList\TemplateList\TemplateList.cpp 1
1 #include
c:\documents and settings\usman.younis\my ...\TemplateList\TemplateList\TemplateList.cpp 2
67 68 intfloatList.show_List(); 69 70 71 Number numArg; 72 string strArg; 73 74 List<Number, string> numberstringList; 75 76 numArg.intData = 23 ; 77 strArg = "twenty three"; 78 numberstringList.add_item(numArg, strArg); 79 80 numArg.intData = 1 ; 81 strArg = "one"; 82 numberstringList.add_item(numArg, strArg); 83 84 numArg.intData = 65 ; 85 strArg = "sixty five"; 86 numberstringList.add_item(numArg, strArg); 87 88 numberstringList.show_List(); 89 }