函数原型 : int puts(const char *str);
#include <iostream>
#include<stdio.h>//puts
using namespace std;
int main()
{
char str1[] = "Happy New Year";
char str2[] = "Happy Birthday";
puts(str1);
/* Printed on new line since '/n' is added */
puts(str2);
return 0;
}
程序中puts()函数的作用与语句“printf("%s\n",s);的作用相同,可以认为puts()是printf()函数的简化版。