有人能解釋爲什麼我收到的時候我使用下列G編譯源此錯誤++編譯器獲得的G ++編譯器
#include <cstdio>
#include <string>
using namespace std;
int main()
{
char source_language[50];
scanf("%16s\n",source_language);
int length = sizeof(source_language);
int sizeofchar = strlen(source_language);
printf("%d\n",sizeofchar);
}
這給了我下面的錯誤
測試的.cpp:在函數 'INT主()':
TEST.CPP:31:錯誤: 'strlen的' 未在此範圍
當我改變宣佈#include <string>
分成#include <string.h>
或#include<cstring>
,它工作正常,我需要弄清楚使用#include<string>
和#include<string.h>
有什麼區別。非常感謝所有幫助
您可以編輯問題的清晰度? 「當我改變#include into #incude或#include」缺少一些信息時,我想。 –
好的,完成了,thanx來展示它 – KItis