Hi guys,
page 1 of the book I'm going through and the code doesn't work. Header
problem? Possibly. Take a look.
It is complaining that 'sort' is undeclared. Now it auto-helps me with the
function paramter list so it knows of it, but it will not compile under VC++
6.0
P.S. The book example doesn't say what headers to include, plus it has int
main(), and no return value for the function. So mine looks slightly
different in those respects.
// Include the Standard Template Library
#include <list>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv)
{
// Create the container, in this case a vector.
vector<string> StringVector;
string TempString;
while (getline(cin, TempString))
{
StringVector.push_back(TempString);
}
sort(StringVector.begin(), StringVector.end());
copy(StringVector.begin(), StringVector.end(),
ostream_iterator<string>(cout, "\n"));
return 0;
}
'sort' is part of list I see from MSDN, so what's up? lol
_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger
|