一、c的頭文件都是以.h結尾,如stdio.h、math.h
二、標準c++的頭文件
1、第一部分,保留了c中的頭文件風格,即大部分c的頭文件都可以在c++中使用,也可以自定義c類型頭文件在c++中使用
2、第二部分,c的標準頭文件在c++中去掉了.h後綴,添加了c前綴,如math.h改爲cmath、stdio.h改爲cstdio。
以stdio.h改爲cstdio說明一下兩類頭文件的不同。stdio.h是以往的C和C++的頭文件,cstdio是標準C++(STL),且cstdio中的函數都是定義在一個名稱空間std裏面的,如果要調用這個名字空間的函數,必須得加std::或者在文件中聲明using namespace std。
此類頭文件的對應關係見:http://www.cplusplus.com/reference/
The elements of the C language library are also included as a subset of the C++ Standard library. These cover many aspects, from general utility functions and macros to input/output functions and dynamic memory management functions。
3、第三部分,c++自身的頭文件,不帶後綴,如iostream。