Click here to Skip to main content
16,004,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I need to do the simulation of the enter key after entering a 4-digit number. Is it possible in C ++?

What I have tried:

printf("\t");
cout << "Ingresar Chapa :" << endl;
string chapaw;
printf("\t");
cin >> chapaw;
HERE INSERT ENTER
Posted
Updated 22-Sep-21 12:42pm

1 solution

Yes. You have printf calls there so, since you are using c-style I/O also, you can use : getchar - C++ Reference[^] and when you get what you want for input you can output an enter character sequence to get the effect you want. That might be a CR (\r) or an LF (\n) or both. I don't know for sure because I haven't worked with console I/O for quite some time and it could be different for Linux versus Windows.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900