+ 2
In getting some question marks inside boxes in case of space' ' . Can anyone please explain why I'm getting that and how to solv
https://code.sololearn.com/cD8YF10R1M0F/?ref=app #include <iostream> using namespace std; int main() { string c; getline(cin,c); int u = c.length(); for(int i = 0;i<u; i++){ if((int)c[i]<90){ int v = (int)c[i]-65; int o = 122-v; cout<<(char)o; } else if((int)c[i]<122){ int v = (int)c[i]-97; int o = 122-v; cout<<(char)o; } else cout<<c[i]; } return 0; }
3 Answers
+ 3
Space has ascci value is 32. so 1st if condition (int)c[i]<90 becomes to true so it will also converted. You should check value in between 65 to 90 or 97 to 122 (not only for less than.) or use if char is not a space in 1st if, and do the next by else if...
+ 2
You're welcome...
+ 1
Thanks a lot for the answerđ