1.getchar:
The prototype is an int getchar (void).
It reads a character from the stdin. The return value is the Ascⅱ code entered by the user, and an error returns-1.
Eg:c=getchar ().
2.putchar:
The prototype is unsigned int putchar (char).
Outputs a character on the stdout. When the output is correct, the output character is converted to the unsigned int value, and the EOF (end of file) end character is returned when the output error is 1.
Eg:putchar (c).
3.gets:
The prototype is char* gets (char* str).
Function: Reads a string from the stdin stream until a newline or EOF is received, and the result of the read is stored in the character array pointed to by the Str pointer. The newline character is not read as the contents of the string, and the read line break is converted to the ' \ s ' null and thus ends the string.
Return value: Read-in succeeded, returns the same pointer as the parameter buffer, encountered EOF (End-of-file) during read-in, or an error occurred, returning a null pointer. So in the case where the return value is null, the ferror or feof function is used to check whether an error occurred or if EOF was encountered.
Note: This function does not detect stack overflow, which overwrites irrelevant data on the stack and can be replaced with fgets (stdin).
Eg:gets (str).
4.puts:
The prototype is an int puts (const char *string).
Writes a string to a standard output device and wraps it in a way that is called, puts (s), where S is a character array or string.
Note: The puts output string is encountered when the ' \ ' is the end of the character characters stop.
Eg:puts (str).
5.cin.get:
Two ways to use:
1) receive a single character: Eg:cin.get (c); <=> C=cin.get ().
2) Receive string: Eg:cin.get (s,n); where S is a character array or string, n is the length of the string-1, automatically assigns the nth bit to '.
6.cin.getline:
Cin.getline (char* str,int N,char f), where Char F can default to ' \ n '.
This function reads multiple characters (including white space characters) at a time. It takes Str as the position of the first read character, and sequentially stores the read character until it reads N-1, or encounters the specified Terminator F. If you do not specify a terminator, the default terminator is ' \ n '.
Eg:getline (s,10, ' * ');
7.getline:
istream& getline (IStream &is, String &str, char delim);
istream& getline (istream&, string&);
The characters read in the input stream is (typically cin) are stored in str until the end of the Terminator Delim is encountered . For the first function Delim is a terminator that can be defined by the user itself, and for the second function Delim the default is ' \ n ' (newline character).
The function ends when it encounters a file terminator (EOF) in the input stream isor encounters an error during the read-in character.
After encountering Terminator Delim,Delim will be discarded and not stored in Str. The next read-in operation will begin reading in the next character of Delim.
Eg:getline (cin,s, ' * ');
GetChar (), Putchar (), gets (), puts (), Cin.get (), Cin.getline (), Getline ()