網頁

C++ 速查手冊 V1.00 - 單元 13 範例




u1303_1.cpp


#include <iostream>
 
int main() {
   typedef int INTEGER;
   INTEGER a = 22;
   std::cout << "a: "
             << a
             << std::endl;

   return 0;
}
 
/* Kaiching Chang 
   u1303_1.cpp
   2014-02 */

u1303_2.cpp


#include <iostream>

struct SomethingWillHappened {
   int a;
};
 
typedef SomethingWillHappened SHDemo;
 
int main() {
   SHDemo d;
   d.a = 22;

   std::cout << "d.a: "
             << d.a
             << std::endl;

   return 0;
}
 
/* Kaiching Chang 
   u1303_2.cpp
   2014-02 */

u1305_1.cpp


#include <iostream>

int main() {
   const int a = 22;
   std::cout << "a: "
             << a
             << std::endl;

   a = 1;

   return 0; 
}
 
/* Kaiching Chang 
   u1305_1.cpp
   2014-02 */

u1305_2.cpp


#include <iostream>

int main() {
   const int End = 0;
   for (int i = 10; i > End; i--) {
      std::cout << i 
                << std::endl;
   }

   return 0; 
}
 
/* Kaiching Chang 
   u1305_2.cpp
   2014-02 */

the end

沒有留言:

張貼留言

0.留言請選擇註冊帳號, Google 或 OpenID 均可
1.歡迎留言交流,但不歡迎垃圾留言及廣告留言
2.文章相關問題歡迎提出,請減少情緒性留言
3.非文章相關內容,請到 G+ 社群 FB 社團提出
4.問作業之留言會被直接刪除
5.莫忘網路禮節
6.可使用部份HTML標記,如 <b> 、 <i> 、 <a>
7.站長保留刪除留言的權力