posts - 403, comments - 310, trackbacks - 0, articles - 7
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          C++ 入門筆記(2)

          Posted on 2007-05-30 20:14 ZelluX 閱讀(340) 評論(0)  編輯  收藏 所屬分類: C/C++

          1. 最近用Dev C++寫的幾個程序中,最容易出錯的就是忘記初始化和數組越界。C++(至少在Dev C++編譯器中)并沒有像Java那樣嚴格的糾錯功能,因此要格外小心。

          2. C++ Programming Language上的一個樣例程序,能看懂,但不能吃透。

           

          #include <iostream>
          #include 
          <vector>
          #include 
          <string>
          #include 
          <fstream>
          #include 
          <iterator>

          using namespace std;

          int main() {
              ifstream fin(
          "p61.in");
              istream_iterator
          <string> ii(fin);
              istream_iterator
          <string> eos;
           
              vector
          <string> b(ii, eos);
           
              ostream_iterator
          <string> oo(cout, "\n");
           
              unique_copy(b.begin(), b.end(), oo);
           
              system(
          "PAUSE");
          }


          3. 向函數傳遞二維指針
          void f(int a[][4]) 或者 void f(int (*a2)[4])

          主站蜘蛛池模板: 英山县| 康保县| 旬邑县| 雅安市| 丰城市| 民县| 阿克| 大渡口区| 福清市| 温州市| 丰都县| 佛教| 承德县| 庄浪县| 丁青县| 婺源县| 曲松县| 信宜市| 孝感市| 法库县| 临安市| 宁德市| 榆社县| 普安县| 阳东县| 法库县| 潞西市| 绵竹市| 运城市| 龙门县| 格尔木市| 闵行区| 江北区| 阜阳市| 武定县| 惠水县| 曲周县| 滁州市| 东阿县| 西峡县| 高唐县|