gets和puts函式
char *gets( char *str );
The gets() function reads characters from STDIN and loads them into str, until a newline or EOF is reached. The newline character is translated into a null termination. The return value of gets() is the read-in string, or NULL if there is an error.
gets函式從標準輸入裝置讀取字串,直到遇到換行或者EOF。換行符被認為是終止字元。若函式呼叫成功,返回字串;否則返回NULL。
int puts( char *str );
The function puts() writes str to STDOUT. puts() returns non-negative on success, or EOF on failure.
puts函式項標準輸出裝置寫出字串。若成功呼叫,返回非負值;否則EOF。注意:這兩個函式都是c語言標準輸入輸出庫中的函式,在使用時要包含<stdio.h>;在c++中應包括<cstdio>。同時這兩個函式的引數都是字元陣列,而不能用c++中的字串物件。