(1)gets(char *str) 需要包含头文件#include
(2)scanf("%[^n]]",str) 需要包含头文件#include
(3)getline(cin,string str) 需要包含头文件#include
(4)cin.getline(char *str, int maxnum) 需要包含头文件#include
C++中,string头文件基本上已经包含在iostream中了。 但是,平时使用的时候建议加上#include
1、使用string类型
2、使用cin、cout语句来输入输出string类型变量(注意,同时还需要#include
3、使用memset()、strlen()、strcpy()等函数时
puts()和gets()函数puts()和gets()函数
1. puts()函数
puts()函数用来向标准输出设备(屏幕)写字符串并换行, 其调用格式为:
puts(s);
其中s为字符串变量(字符串数组名或字符串指针)。
puts()函数的作用与语printf("%sn", s)相同。



