#9331: 會出現CE


b9802104 (b9802104)


 我在自己dev c跑得過
但放來這邊就會出錯 
 
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

int main(void)
{
  char line[256];
  char a;
  int length;

  while(cin.getline(line,256))
  {
  length = strlen(line);
  for (int i = 0 ; i <= length ; i++)
     {
        a = line[i];
        a -=7;
        cout << a;
     }
  cout << endl;
  }

//    system("PAUSE");
    return EXIT_SUCCESS;
}
 
------------------------------------------------------------------------------------- 
/code_2019287.cpp: In function ‘int main()’: 
/code_2019287.cpp:16:23: error: ‘strlen’ was not declared in this scope 
#9332: Re:會出現CE


gtyuse (gtyuse)


/code_2019287.cpp: In function ‘int main()’: 
/code_2019287.cpp:16:23: error: ‘strlen’ was not declared in this scope 

< string > 和 < string.h > 不一樣喔

 

DEVC++ 貌似自己幫你 include 了

所以要加 < string.h > 或 < cstring > 

上面是 ANSI C 的 

而 string 是 C++ 的 STL