#include<iostream>
#include<string>
#include <stdio.h>
usingnamespace std;
char * scanf(char * a)
{
while(*a!='\0')
{
if(*a=='t')
*a='lp';
a++;
}
return a;
}
int main(void)
{
char string[]="the man is not thinking what the weather is like today";
scanf(string);
printf("%s \n",string);
system("PAUSE");
}
lp is two characters not one. So who knows what the actual value of 'lp' is. Also, you have a few naming conflicts that I am surprised you didn't get warnings for. Such as the function scanf, and an array named string while you have the string library and the std:: namespace in the global scope. To do it the way currently would be kind of tricky. Basically you would have to assign each t as an l then, shift every thing to the right one space so you can assign the next character a p.
May I ask why you include iostream (c++) and stdio (c) and then only use the stdio (printf). If you can use c++ I would suggest using std::string instead of an array of characters. Because with your current array of characters you can't shift left. It would need to be dynamic. Also, why are you returning if you never actually use the return type?
well if you are creating it in c++ you should use iostream and use cout/cin instead of printf/scanf. As for creating without std::string you are going to need dynamic arrays then or allocate more space on your static array. Right now there is no padding space for the extra 7 characters to go. You could possibly try using the replace or insert/find functions in the string library for this or shift the stuff to the right manually I suppose.