Hi,
i have the following class :
class Book
{
string Category;
string SubCategory;
Book(string Cat, string SubCat)
{
Category = Cat;
SubCategory = SubCat;
};
};
in my cpp file, i use a vector of this class:
vector<Book> My_Book;
My_Book.push_back(Book("Cat1","SubCat1"));
My_Book.push_back(Book("Cat2","SubCat2"));
My_Book.push_back(Book("Cat3","SubCat3"));
// this works great...but how can i display later my data ?
i tried :
char buf[1024];
for(int i=0;i<My_Book.size();i++)
{
wsprintf(buf,"Element %d : %s\n",i+1,&My_Book.at(i).Category);
TRACE(buf);
}
but it doesn't work... i mean &My_Book.at(i).Category
i have partially good result...but just partially :(
something like : IIIICat1 and IIIIcat2,....
thx for help,
Maileen