you could just do
Code:
#include <algorithm>
char search(vector<char> line, char letter)
{
temp = std::find( line.begin(), line.end(), letter);
if (temp == line.end() )// not found
cout << "letter could not be found.\n"
return *temp; //useless really since you have letter in letter
but to be honest, you can ditch the search function and use find directly. especially since it was stated you are returning letter no matter what.
Code:
if (std::find( line.begin(), line.end(), letter)==line.end())
cout << "letter could not be found.\n"
//letter still equal letter