竞聘手术室护士长2016:求助:有关gets()
来源:百度文库 编辑:查人人中国名人网 时间:2024/10/04 05:56:36
很奇怪
比如在他之前有条cout
先执行gets,在执行cout
如果cout里有'\n',还是这个顺序
如果不是'\n',而是endl;则先执行cout语句
我被搞糊涂了,到底有什么规则
如果说和编译器有关能不能再解释得更清楚点
谢谢
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
不知道你说的什么意思,我把gets的用法给你贴出来吧!
gets, _getws
Get a line from the stdin stream.
char *gets( char *buffer );
wchar_t *_getws( wchar_t *buffer );
Routine Required Header Compatibility
gets <stdio.h> ANSI, Win 95, Win NT
_getws <stdio.h> or <wchar.h> ANSI, Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns its argument if successful. A NULL pointer indicates an error or end-of-file condition. Use ferror or feof to determine which one has occurred.
Parameter
buffer
Storage location for input string
Remarks
The gets function reads a line from the standard input stream stdin and stores it in buffer. The line consists of all characters up to and including the first newline character ('\n'). gets then replaces the newline character with a null character ('\0') before returning the line. In contrast, the fgets function retains the newline character. _getws is a wide-character version of gets; its argument and return value are wide-character strings.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_getts gets gets _getws
Example
/* GETS.C */
#include <stdio.h>
void main( void )
{
char line[81];
printf( "Input a string: " );
gets( line );
printf( "The line entered was: %s\n", line );
}
Output
Input a string: Hello!
The line entered was: Hello!
参考资料:更多请参考MSDN!
被你说糊涂了,呵呵
能不能把代码贴出来看看?