Hey, i was reading up on find function and i came across this line.
size_t find ( const char* s, size_t pos, size_t n ) const;
Correct me if im wrong, but it basically allows us to search a string based on the information inside an array right?
After searching online , i realize that alot of people use it to check how many times a certain character which they input will be in the array.
for example.
array = ["ttt ttt ttt"]
basically , they will input in the character they want to find ,(in this case 't) , and the prog will count how many times 't' appears in the array.
What i am curious to know if this function can be used like the way i did below. i tried typing out this code but it dosnt seem to work. What i am trying to do is to input in a string and then using the array to find if any of the characters in the array exist.
int main()
{
string str = "BE";
int b = 0 ;
const int arraySize2 = 19;
char array2[arraySize2] ={'A','B','E','F','G','H','J','K','N','O','P','Q','R','S','T','U','W','Y','Z'};
for (int i = 0 ; i < str.length() ; i ++)
int b = str.find(array2[i]);
cout << b << endl;
Is it possible to be used this way and if it is, what is the problem with my coding?