原创 c++ 基本數據類型長度(vc6.0 32位機;

c++ 基本數據類型長度(vc6.0  32位機; size of int is:   4size of char is:   1size of short int is:   2size of double is:   8size of

原创 動態內存分配

  在程序運行過程中,堆內存能夠被動態地分配,new和delete兩個運算符分別用於堆內存的分配和釋放。    注意:malloc,free和new ,delete的不同,前者是函數而後者是運算符。new和delete都是單目運算符

原创 assert的使用

#include<iostream>#include<assert.h>using namespace std;int main()...{    assert(4>3);//斷言、程序每次運行時都檢查參數的是不是真,真則繼續、否則報錯

原创 iostream.h學習

#include<iostream>using namespace std;int main()...{    int c;    c=(char)'a';    char* str=isalnum(c)? "yes":"no";   

原创 虛析構函數的使用條件

  如果一個類不會用作基類,就不需要使用任何虛函數,因爲使用虛函數會增加程序的開銷。     但是,如果要作爲基類,爲維護完整性,就需要使用虛函數,讓子類定義自己的具體行爲。         所以基本的一條是,無故的聲明虛析構函數和永遠不

原创 對C++多態學習的一點感受

對C++多態學習的一點感受 原創:郭萌 2002年9月3日 多態考慮的是類與類之間的層次關係以及類自身內部特定成員函數之間的關係問題,是解決功能和行爲的再抽象問題。多態是指類中具有相似功能的不同函數是用同一個名稱來實現,從而可以使

原创 cin反衝區問題

#include<iostream> using namespace std; int main(int argc,char* args){ int i; cin>>i; cout<<i; //fflush(stdin); cout<<"

原创 RHEL 5 下載

RHEL 5 無限制全速下載!!!(兩個版本) I386版:ftp://60.232.126.152/os/linux/redhat/rhel5/rhel-5-server-i386-disc1.isoftp://60.232.126.1

原创 數組做函數參數時求長度和輸出所有元素的方法

#include<iostream> using namespace std;template <class t>t foreach(t* p){ int i=0; while(*p!='/0') {cout<<*p<<endl; p++