ok i seem to have gotten a lot closer to my desired output for the anomalies array:

while(!infile.eof())
{
location = search(starNames, target, numStars);

if(location != -1)
if(signal >= hvalues[location] || signal <= lvalues[location])
anomalies[location] = anomalies[location] +1;
else
anomalies[location] = 0;

else
cout<<"Star doesn't exist." <<endl;

getline(infile, target);
infile >> signal;
infile.ignore(256,'\n');

}

doing that gives me the correct number for 3 out of the 5 stars.
its giving one anomaly for two of the stars. im unsure why its doing that.