(C++ ) how to hide user input after execute | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

(C++ ) how to hide user input after execute

Any body help I want to hide my input in c++ For Example int number; cout<<"Enter the Number"; cin>>number; cout<<" Number is <<number; output : Enter number 23 Number is 23 In this code the User input also shown in program but I want when I press enter "Enter number 23" user input automatically removed just display "Number is 23". Anybody whose expert in c++

8th Aug 2021, 6:55 PM
Junaid Ul Hassan
Junaid Ul Hassan - avatar
1 Answer
+ 3
Use '\b'. It erases one character, and the cursor moves back. std::cout << "nawaz"; //screen shows : nawaz std::cout << '\b'; //'z' is erased But I haven't tested because computer isn't near. https://www.google.com/search?q=C%2B%2B+delete+character+from+console
8th Aug 2021, 8:01 PM
A . JD
A . JD - avatar