gets()函数包含在stdio.h文件中
#include <stdio.h>
int main( void )
{
char line[21]; // room for 20 chars + '\0'
gets( line );
// C4996
// Danger: No way to limit input to 20 chars.
// Consider using gets_s instead.
printf( "The line entered was: %s\n", line );
}
应该和string没什么关系,你看下是不是你的用法有错误