How to suspend a program in C Language
# Include "stdio. h "getchar () is used to retrieve the carriage return # include" string. h "# include" stdlib. h "system (" pause ") # include" conio. h "getch ()
Paste an example of another person: How do I remove the Enter key when reading characters using getchar? In the c language of linux, when you want to read a character (such as 'Z'), you can use the c = getchar () function, enter Z in the terminal, and then press the Enter key, in this case, Z characters are stored in c. When we use c = getchar () again to obtain another character (for example, 'q'), we get a carriage return. Therefore, we usually use getchar twice to avoid the influence of carriage return. C = getchar (); // get Z getchar (); // read the carriage return from the buffer ...... ...... ...... C = getchar (); // used to read Q getchar (); // read the carriage return from the buffer.