Comparing strings in a vector

The following is code from one of my functions. This particular function's goal is to get how many users are playing, and to get all of their names. If two or more of their names are the same then it will make a bool (error) true. I got the idea of comparing them from a bubble sort. For some reason I get a weird error that pops out and it ask me to break or continue(you probably know what annoying error I'm talking about). If I go back to the debug, it works, but it is frozen.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
int num_players;
	bool error=false;
	while(true){
		system("cls");
		cout<<"How many people will be playing?"<<endl;
		cin>>num_players;
		cin.ignore();
		if(num_players==1)
		{
			cout<<"You can't choose only 1 player in Multi-Player"<<endl;
			pause();
			system("cls");
		}
		if(num_players==0)
		{
			cout<<"Very funny pal. You can't pick 0 players in ANY game mode."<<endl;
			pause();
			system("cls");
		}

		else if(num_players>=2)
		{
			break;
		}
	}


	for(int i=0; i<num_players; i++)
	{
		players.push_back(fighter());
	}
	system("cls");
	while(true)
	{
		for(int i=0; i<players.size();i++)
		{
			cout<<"Please enter in the names of the players"<<endl;
			getline(cin, players[i].name);
			system("cls");
		}

		for(int a=0; a<players.size(); a++)
		{
			if(players[a].name==players[a+1].name)
			{
				error=true;
			}
			else;
		}
		if(error==true)
		{
			cout<<"Two or more players have the same name."<<endl;
			for(int a=0;a<num_players;a++)
			{
				players.pop_back();
			}
		}
		else if(error==false) break;
	}
Never mind. I see ny mistake with players.pop-back().
Topic archived. No new replies allowed.