#include <list>
#include <string>
#include <iostream>
using namespace std;
int main()
{
list<string> nums;
list<string>::iterator iter;
nums.push_front("George ");
nums.push_front("of ");
nums.push_front("the ");
nums.push_front("jungle");
for (iter = nums.begin(); iter != nums.end(); iter++)
{
cout << *iter.length() << " "; //is this the correct way to access the member function?
}
return (0);
}
Need help with STL lists
I''m using the STL list type in a program, and I need help with accessing the member functions of a class that makes up the list.
For example:
''''I can imagine a world without hate, a world without fear, a world without war. And I can imagine us attacking that world, because they would never expect it.'''' -Jack Handy
_______________________________________________________________________________________''I can imagine a world without hate, a world without fear, a world without war. And I can imagine us attacking that world, because they would never expect it.'' -Jack Handy
use (*iter).length() or iter->length() .
But... but that''s what HITLER would say!!
But... but that''s what HITLER would say!!
Thank you so much!
''''I can imagine a world without hate, a world without fear, a world without war. And I can imagine us attacking that world, because they would never expect it.'''' -Jack Handy
''''I can imagine a world without hate, a world without fear, a world without war. And I can imagine us attacking that world, because they would never expect it.'''' -Jack Handy
_______________________________________________________________________________________''I can imagine a world without hate, a world without fear, a world without war. And I can imagine us attacking that world, because they would never expect it.'' -Jack Handy
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement