Why it is not giving output 1264

why its wrong
string s=β€œ1234”;
s[2]=β€˜9’-s[2];
cout<<s;

@guptanikhil898
check this-


you were trying to store number 6 in s[2] while it should have a character so u have to do + β€˜0’
to make it a character then store in s[2]
I hope your doubt is cleared don’t forget to mark it resolved in my doubts section :smiley: