I've made a small vector, that holds single characters, and i've made a small function that iterates through the vector to find a letter the user inputs. It works fine if the letter is in the vector, but how could i make it say "letter could not be found" or something similar? here's my function if it's any use:
Code:char search(vector<char> line, char letter) { char temp; vector<char>::const_iterator iter; iter = line.begin(); while (*iter != letter) { if (*iter == letter) { temp = *iter; } else { iter++; } } return temp; }



LinkBack URL
About LinkBacks



