Home  >  Q&A  >  body text

c++中头文件<string.h> <string>有什么区别麽?还有<cmath> <math.h>

如题所示,c++中头文件<string.h> <string>有什么区别麽?还有<math> <math.h>
编译器都能过,请指教。

大家讲道理大家讲道理2765 days ago634

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-17 15:18:11

    <string.h> C version header file.
    <string> The header file defined by the C++ standard, which defines a string class of string, which contains various operations of the string class. Moreover, <string> also includes the old C version of string operations such as strcpy, strcat, etc. This is equivalent to adding an #include< in addition to defining its own string class in the <string> file. ;string.h> contains the C version of string operations.

    The relationship between <math> and <math.h> is the same as above.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:18:11

    The corresponding C++ header file of

    <string.h> is <cstring>
    <math.h> The corresponding C++ header file is <cmath>
    <string> is C++ std:: string
    <math>I don’t know what it is either

    reply
    0
  • 迷茫

    迷茫2017-04-17 15:18:11

    +1 upstairs.
    Moreover, in C++11, if you add .h, there should be a warning or an error, right?

    reply
    0
  • Cancelreply