PIXNET Logo登入

.: iceis' Blog :.

跳到主文

給生活一點安可 <( ′.‵)y

部落格全站分類:職場甘苦

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 4月 23 週日 200623:01
  • [C/C++]Static v.s. Shared "C" Libraries

之前工作需要研究一下libraries,所以找了一些資料,
發現這個網站講的蠻不錯的,
想要了解Library的可以參考一下,
Building And Using Static And Shared "C" Libraries
還有一些其他的Tutorials也不錯唷:)
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(243)

  • 個人分類:C/C++
▲top
  • 4月 23 週日 200622:34
  • [C/C++]malloc( ) v.s. calloc( )

refer to What is the difference between malloc and calloc functions?
簡單的說,
calloc(m, n);
就等於
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(1,134)

  • 個人分類:C/C++
▲top
  • 6月 10 週五 200523:30
  • the exit function

refer to http://www.cppreference.com/stdother/exit.html
Syntax:
#include
void exit( int exit_code );

The exit() function stops the program.
exit_code is passed on to be the return value of the program,
where usually zero indicates success and non-zero indicates an error.
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(149)

  • 個人分類:C/C++
▲top
  • 6月 06 週一 200500:16
  • Reverse a word in c/c++

refer to the article http://www.ozzu.com/ftopic1910.html
void rev(char* s)
{
int inner, outer= strlen(s)-1; // 原文誤植為2
char temp;
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(164)

  • 個人分類:C/C++
▲top
  • 5月 05 週四 200514:23
  • Thinking in C++ 2nd Edition電子書(free download)

Thinking in C++ 2nd Edition by Bruce Eckel
Free Electronic Book
Volume 1 & Volume 2
Download from Here!
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(1,694)

  • 個人分類:C/C++
▲top
  • 5月 05 週四 200514:00
  • Virtual Function in C++

=====================
#include
#include
using namespace std;
class Pet {
public:
    virtual string speak() const { return "Pet!"; }
};
class Dog : public Pet {
public:
  string speak() const { return "Bark!"; }
};
class Cat : public Pet {
public:
  string speak() const { return "Miao!"; }
};
void doSpeak(Pet &animal){
    cout << animal.speak() << endl;
}
int main() {
    Dog dog;
    Cat cat;
    Pet pet;
    
    //Late binding for both:
    doSpeak(dog);
    doSpeak(cat);
    doSpeak(pet);
    return 0;
}
==================
output結果:
Bark!
Miao!
Pet!
==================
若Pet中的speak( ) 不宣告為virtual,則output:
Pet!
Pet!
Pet!
==================
Dog跟Cat是繼承自Pet這個base class,
經由virtual的宣告,可以在doSpeak中藉由傳進來的類別(Dog or Cat)判斷要做誰的doSpeak();
若Dog或Cat中,不去override speak這個function,當然都會output: Pet!
若將Pet中的speak() 改寫成virtual string speak() const  = 0;
( = 0是pure virtual funcion的關鍵字)
則該virtual function會變成pure virtual function,
進而讓Pet這個class變成abstract class,
在程式中宣告任何Pet的Instance都會造成compile error,
一定要有derived class才能去宣告該class的instance。

(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(1,564)

  • 個人分類:C/C++
▲top
  • 1月 07 週五 200500:37
  • 二維的動態陣列

[ By Tonnny @ ptt]
// 如此可產生n*m的array.....
// n,m可由使用者輸入!
// 重點是,此array可以在functions內使用
#include

void main(){
int n;
int m;
cin >> n >> m;
int **a=(int **)new int*[n];
for (int i = 0; i < n; i++)
{
*a(m+i)=(int *)new int[i][m];
}
for (int k = 0; k < n; k++){
for (int j = 0;j < m; j++)
{
a[k][j] = 0;
}
}
for (i = 0; i < n; i++)
{
delete [] a[i];
}
delete [] a;
}
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(79)

  • 個人分類:C/C++
▲top
  • 12月 27 週一 200416:49
  • goto是惡魔還是天使

http://ehome.hifly.to/showthread.php?s=&threadid=889
goto到底該不該用?
基於在論壇上走動的大半是學生,所以通常我不太對這問題發表個人意見,
以免影響學生成績。
最近看到一論壇又有多篇有關 goto 指令該不該(或可不可用)用的討論。
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(62)

  • 個人分類:C/C++
▲top
  • 11月 10 週三 200412:56
  • C/C++中使用assert

in C : #include
in C++ : #include
ps.C++中include c的library header file,可直接寫且不需副檔名
c++中 include 需加using namespace
如果是include 等原本是c的lib則不用
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(855)

  • 個人分類:C/C++
▲top
  • 10月 20 週三 200419:12
  • C/C++ Programming interview questions and answers

C/C++ Programming interview questions and answers
(繼續閱讀...)
文章標籤

iceis 發表在 痞客邦 留言(0) 人氣(339)

  • 個人分類:C/C++
▲top
12»

My Plurk

aNobii

My Lijit

個人頭像

iceis
暱稱:
iceis
分類:
職場甘苦
好友:
累積中
地區:

參觀人氣

  • 本日人氣:
  • 累積人氣:

近期文章

  • [京都自由行] 行前 - JR WEST PASS
  • 新生活運動
  • 舊鞋變新鞋
  • 煎蛋的先生 ?!
  • My Plurk
  • Firefox Download Day
  • [京都自由行] 行前 - 訂機票
  • Google Reader 密技?
  • Google Developer Day
  • Google工程師薪水知多少?

文章分類

toggle Computer Science (7)
  • Java (9)
  • C/C++ (17)
  • Web Design (17)
  • PHP (10)
  • Tools (9)
  • Others (8)
  • *nix (1)
toggle Travel (2)
  • Abroad (4)
  • Domestic (13)
toggle Life (6)
  • T Job Diary (4)
  • Wretch Blog (4)
  • Army_life (2)
  • O Job Diary (22)
  • food (14)
  • song (6)
toggle Research (2)
  • Research_Life (11)
  • OGRE (13)
  • bookwin's murmur (2)
  • Murmurings (129)
  • 未分類文章 (1)

文章彙整

部落格文章搜尋