Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jbell

whats wrong with this sort?

This topic is 6109 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

  
#pragma warning ( disable : 4786 )
#include <string>
#include <vector>
#include <iostream>
#include <fstream>

using namespace std;

int x;
int stop;

void main()
{
	string tmp; 
	vector <string> data;
	ifstream in; 
	in.open("data.txt");
	
	while (in.eof() == false)
	{
		std::getline( in, tmp);
		data.push_back(tmp);
		stop++;
	}	
	
	std::sort(data.begin(), data.end);
	std::get
	for (x=0; x<stop; x++)
	{
		cout<< data[x] << endl;
	}
}
  
it takes the variable data and assigns a movie name to each element in the array... like data[1] is terminator 2, data[2] is scary movie etc. i get the errors
  
error C2039: ''sort'' : is not a member of ''std''
error C2065: ''sort'' : undeclared identifier
  
when clearly it is a member.. i type std:: and source shows up... what can i do?

Share this post


Link to post
Share on other sites
Advertisement
It might be because you are already using the std namespace. And since you are already using it, it doesn''t recognize it as a scope resolution operator.

---
Make it work.
Make it fast.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!