Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Search function Infinite loop problem

$
0
0
I am a bit stuck on this one. My loop gets stuck in an infinite loop when it
finds the 'team'. Here's the code.

//overlaoded operator
bool operator == ( const FootballTeam& team )
	{ if ( city == team.city ) return true ; return false; }

//search for team
void searchTeam ( List<FootballTeam>& display )
{
	FootballTeam team;
	string input;

	bool found = false;

	cout<<"Enter the city of the team to display: ";
	getline ( cin, input);

	while ( input != "N/A" )
	{
		team.city = input; 

		found = display.getMember(team);

		if(found)
		{
			cout << team;
		}
		else
		{
			cout<<"That team is not found \n";
			cout<<"Enter city again: ";
			getline ( cin , input ); 
			cout << endl;
		}

		cout << endl;
	}
	
}



Any ideas to why its doing this? Any help is appreciated!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>