Why am i getting the error please correct my code and let me know my mistake

#include
using namespace std;
void replacePi(char a[],int i) {
if(a[i]==’\0’)
{
return;
}
if(a[i]==‘p’ and a[i+1]==‘i’) {
int j=i+2;
while(a[j]!=’\0’) {
j++;
}
while(j>=i+2) {
a[j+2]=a[j];
j–;
}
a[i]=‘3’;
a[i+1]=’.’;
a[i+2]=‘1’;
a[i+3]=‘4’;
replacePi(a,i+4);
} else {
replacePi(a,i+1);
}
return;
}
int main() {
char a[1000];
cin>>a;
replacePi(a,0);
cout<<a<<endl;
return 0;
}

Hello @tarunasree123 your code is not even compiling.
could you please check whether you have share the correct code or not?

@tarunasree123 see this code:


only the logic of your code is correct.
if you have any doubt you can ask here:
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.