Thursday, July 9, 2009

What is wrong with my declarations in C++?

#include %26lt;iostream%26gt;


#include %26lt;list%26gt;


#include %26lt;conio.h%26gt;





using namespace std;





main()


{


list newList;


getch();


}





I am using Dev-C++ as my Compiler... When I try to run this program, the error says... "missing template arguments before "newList" and 9 "expected `;' before "newList" "





Am I missing something, or it is just not the proper declaration of the class?

What is wrong with my declarations in C++?
list is a template, i.e. you have to specify what you want a list *of*. Use something like this....





list%26lt;int%26gt; newList;


newList.push_back(7); // push the integer 7 onto the list
Reply:list newList();

wedding floral centerpieces

No comments:

Post a Comment