Why x is not getting included in my input???
#include
using namespace std;
void replacepi(char *a,int i){
//base case
if(a[i]==β\0β || a[i+1]==β\0β){
return;
}
//recursive case
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--;
}
//copying the 3.14
a[i] = '3';
a[i+1] = '.';
a[i+2] = '1';
a[i+3] = '4';
//recursion to solve for the smaller arr
replacepi(a,i+4);
}
else{
replacepi(a,i+1);
}
}
int main() {
int n;
cin>>n;
while(n>0){
char a[1000];
cin.get();
cin.getline(a,1000);
replacepi(a,0);
cout<<a<<endl;
n--;
}
return 0;
}