alright..so i have to create an overloaded func where i replace O with E in str and replace world with jack in str and print from main using pointers to pass my strings to the func(needs to adhere to the mentioned)...need help ASAP ppllzz..
thnx
#include <iostream>
using namespace std;
void strrep(char *ptr, char *charactobereplaced);
void strrep(char *ptr, char *wordtobereplaced)
int main()
{
char str[] = "hello world";
char wordtobereplaced[] = "world";
cout<<"The string is "<<str<<" and I will replace o's with e's"<<endl;
strrep(str, "o");
cout<<"The modified string is "<<//how can i print from here???<<endl;
strrep(str, wordtobereplaced)
cout<<"The modified string is "<<//how can i print from here???<<endl;
return 0;
}
void strrep(char *ptr, char *charactobereplaced)
{
while(*ptr == '/0')
{
if(*ptr == *charactobereplaced)
{
ptr = "e";
}
*ptr++;
}
}
void strrep(char *ptr, char *wordtobereplaced)
{
while(*ptr == '/0')
{
}
}