strings and char's
I was wondering if anyone here perhaps know how to traverse the indivdual chars in a string. I am writing a cpp file that finds email in any valid txt file and writes them to another file of the users choosing. To start my i have an if statement
for(int i = 0; i < meDeque.size(); i++)
if(myDeque[i] == '@')
and all the rest
the problem is when i compare the strings to a char character such as that @ symbol in single quates my compiler does not like it. Does anyone know the proper way to compare and traverse the individual char in the strings? Thank you.
Wrong way to do it. Use one of the string functions, like this one:
Just to let you know: there is nothing wrong in comparing a character in a string returned by  operators with another character. And from the code posted, I couldn't deduce if string::find is or isn't appropriate.
The problem is elsewhere: may-be that you have a misspelling meDeque-myDeque.
It is also very unlikely that the compiler would say: "Line 42: [Error] I don't like it". Reading, thinking about and posting (if you can't figure it out) what the compiler says is pretty important.
Use the code tags for code next time.
Perhaps I shouldn't have said it's wrong per se. You are correct that it can be done, and produce the same results.
I would argue, though, that the string functions, such as find(), would be better appropriate for telling you where, if at all, a given substring is located inside the current string. These functions are safer to use since you won't run the risk of writing the loop incorrectly. Besides all of that, you don't have to reinvent the wheel if you use the functions provided.