I have refered previous questions but none of those helped. Issue is similar as mentioned here: Why does the terminal show "^[[A" "^[[B" "^[[C" "^[[D" when pressing the arrow keys in Ubuntu?
Interestingly, while taking input in python does not have this issue.
I have tried various things including using "bash" shell (3.2), using iTerm2 instead, running macos 11.4 in safe mode. Terminal app’s key bindings are as default settings. None of the mentioned helped.
- How can this be avoided?
C++ Code screenshot added. C++ Code
Source: Windows Questions C++