The current (and final) problem is this.
When I enter "Q" the first time because I don't want to search everything is fine and it just quits and goes to the next function. BUT when I enter a city that is found and then try to quit, it doesn't work. It will just read back " not found".
It always cuts off the first letter. If I searched for cplusplus.com it would read back "plusplus.com not found". It's not quitting after I find a city though. What should I change?
void findCityData (string city[], double budget[], double revenue[], int NumCities)
{
string target;
int pos;
cout << "Enter the name of the city or Q to quit:";
getline (cin,target);
while(target != "Q" && target != "q")
{
pos = searchFunction (city, NumCities, target);
if (pos == -1)
{
cout << target << " not found." << endl;
findCityData (city, budget, revenue, NumCities);
}
cout << city[pos] << " has a budget of " << budget[pos] << " and revenue totaling " << revenue[pos] << endl;
cout << "Enter the name of the city or Q to quit:";
cin.ignore();
getline (cin,target);
}
I really don't know. I commented it and it appears to be working in Unix now. We have a set number of things we're supposed to input and after I input them and press "Q" to quit, I get a Bus error. I'm not even sure what that is.