#include "stdio.h" GetChar () to remove carriage return # include "String.h" #include "stdlib.h" System ("pause") #include "conio.h" ge TCH () An example of someone else: how do I remove a return key when I use GetChar () to read a character? In the C language of Linux, you can use the C=getchar () function when you want to read a character (for example, ' Z '), enter z in the terminal, and then press the ENTER key, in which case the z character is stored in C. When we use C=getchar () again to get another character (say ' Q '), we get to the fact that it is a carriage return. So we usually use the GetChar two times to avoid the effect of carriage return. as follows: C=getchar ();//Get z GetChar ();//Enter the carriage return from the buffer read ... c=getchar ();//used to read Q GetChar ();//To read the carriage return from the buffer
Method of suspending program in C language