using namespace std;
int main() { char str[80]; char find[10]; char change[10]; char* pstr; char* temp = new char[80]; cin.getline(str, 80); cin.getline(find,10); cin.getline(change,10);
pstr =strstr(str,find);
int index=str.find(find);
int len=strlen(str);
str.replace(index,len,change);
delete []temp;
cout<< str<< endl;
return 0;
} request for member ‘find’ in ‘str’, which is of non-class type ‘char [80]’ It keeps saying int index=str.find(find); I don't know what you mean
c++
Error when trying to use char array like an object.
The find function does not call with a char array, but with a string object.
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
string a = "This is C++";
string b = "C++";
size_t index = a.find(b);
cout << index << endl;
return 0;
}
529 Uncaught (inpromise) Error on Electron: An object could not be cloned
546 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
547 PHP ssh2_scp_send fails to send files as intended
546 Understanding How to Configure Google API Key
700 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.