I have written the code below. The matter is this: after I read the x
and y
from input stream there is not matter - mean x
and y
are the exact value of input - but later they change to some other value.
what's the matter? I can not understand it!!
int count(char s[], char ss[] , long long int posF, long long int posE){}
int main()
{
char s[]{};
int q = 0;
cin >> s;
cin >> q;
int choise = 0;
while(q--)
{
cin>>choise;
if(choise == 1)
{
int x = 0;
cin>>x;
char c;
cin>>c;
s[x-1] = c;
}
else if(choise == 2)
{
int x = 0;
int y = 0;
cin>>x>>y;
//Fist LOG
cout<<"First log x and y are correct "<<x<<" "<<y<<endl;
char ss[]{};
cin>>ss;
//Second LOG
cout<<"Second log x and y are wrong?Why?"<<x<<" "<<y;
cout<<count(s, ss, x-1, y-1)<<endl;
}
}
return 0;
}