--------------------------------------------------------------------------------
I am trying to do a program that will use a function to search a string for an occurence of another string. Can someone please tell me what is wrong with this?
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
void replaceSubstring(string, string, string);
int main(){
string string1, string2, string3;
cout <<"Substring Program!\n\n\n";
cout << "Please enter string one: \n";
getline (cin, string1);
cout << "Please enter string two: \n";
getline (cin, string2);
cout << "Please enter string three: \n";
getline (cin, string3);
replaceSubstring(string1, string2, string3);
system ("pause");
return 0;
}
void replaceSubstring(string string1, string string2, string string3){
char* a=NULL;
a=strstr(string1, string2);
cout << a;
}
I get this error:
"no matching function for call to `strstr(std::string&, std::string&)' "