#include <cstring>
using namespace std;
int main()
{
char str[101];
gets(str);
if(str[0]>='a' && str[0]<='z')
str[0]-=32;
for(int i=1;i<strlen(str);i++)
{
if(str[i-1]==' ' && str[i]>='a' && str[i]<='z')
str[i]-=32;
}
puts(str);
return 0;
}
某些编译器下为何会出现如下编译错误???如何解决???
error: 'gets' was not declared in this scope
error: 'strlen' was not declared in this scope
error: 'puts' was not declared in this scope
C++中如何调用puts(),gets()函数???
7 个解决方案
#1
#include<cstdio>
#2
#include <cstdio>
#3
#include<cstdio>
puts(),gets()的声明是在这个头文件里的
puts(),gets()的声明是在这个头文件里的
#4
strlen是在#include<string.h>里面吧
#5
#include <cstdio>
#6
楼上都回答了,jf!谢谢~!
#7
#include <cstdio>
#1
#include<cstdio>
#2
#include <cstdio>
#3
#include<cstdio>
puts(),gets()的声明是在这个头文件里的
puts(),gets()的声明是在这个头文件里的
#4
strlen是在#include<string.h>里面吧
#5
#include <cstdio>
#6
楼上都回答了,jf!谢谢~!
#7
#include <cstdio>