MC felon wrote:
In future, please a) quote some context in your reply and b) post
something that compiles on its own.
here's what i have tried:
cout<< "enter a string\n\n";
gets(take);
gets is vile (the root or most buffer overflows), avoid at all cost.
Use std::getline, which takes the maximum buffer size as a parameter.
//calculation
int len = 0;
Introduce len where it is assigned.
char temp[2];
len = strlen(take);
for(int g=0;g<len;g++)
{
while(take[g] != ' \0 ')
You don't want this inner loop, the for is already traversing take. Use
one or the other.
You would be best to declare a second array, double the size of take and
copy the characters to this. Where take[g] == 's', add an 'h'.
//dont know what to do
}
}
}
cout<< take;
Should add << std::endl here.
why?