C++ #include,幾時打.h,打左.h同唔打.h有咩分別

我做功課時include左3個funtion
iostream cmath iomanip
iostream同iomanip要打.h先run到,但係cmath就唔打run到,打左run唔到,
其實.h點解???

http://msdn.microsoft.com/en-us/ ... %28v=VS.100%29.aspx
請善用Google/Bing... "C++ #Include"

TOP

我無問題wor
  1. #include <iostream.h>
  2. #include <iomanip.h>
  3. #include <cmath>

  4. int main()
  5. {
  6.     const int max = 12;
  7.         const int width = 6;
  8.         for(int row = 1;row <= max;row++) {
  9.                 for(int col = 1;col <= max;col++) {
  10.                         cout << setw(width) << row * col;
  11.                 }
  12.                 cout << endl;
  13.         }
  14.        
  15.     double y = 12.0;
  16.     for (int i=0; i<5; i++) y+=0.1;
  17.     printf("round of %.1lf is  %.1lf\n", y, round(y));


  18.     double x = 12.5;
  19.     printf("round of %.1lf is  %.1lf\n", x, round(x));
  20.     return 0;

  21. }
複製代碼

TOP