Time of Update: 2015-04-29
標籤:方式一:值傳遞 值傳遞時,會另外開闢一個空間儲存函數參數,作為臨時變數。無論傳遞的是指標(數組名)還是普通變數,都是如此。當傳遞的是指標變數(數組名)時,原指標的值不會改變,但是指標指向的內容會改變。方式二:引用
Time of Update: 2015-04-29
標籤:(一)符號常量宏定義是C語言中的一種替換策略,即使用預先處理命令 #define 將一串(冗長的)文本與某個名字(稱為宏)等同起來,然後就可以在原始碼中大量使用宏。在預先處理階段再將原始碼中的宏替換為原來的文本。例如,在原始碼中:#define PI
Time of Update: 2015-04-28
標籤://有這樣一個二維矩陣A[N][N],滿足j < k時, 1)a[j] < a[k]; 2)a[j] < a[k]//(其實就資料從左上方到右下角縱橫方向上都遞減),給定一個數target,如何快//速搜尋是否 在這個矩陣中,是的話輸出二維座標,否則輸出Null。 #include <iostream>using namespace std;void Grial(int (*a)[4],int x){int i = 0;int j = 3;while(i!=3
Time of Update: 2015-04-23
標籤:// 求兩個整數中的較大者#include <stdio.h>int max( int a, int b ){int temp;if( a > b ){temp = a;}else{temp = b;}return temp;}int main(){int a,b;printf("請輸入要比較的兩個數:\n");scanf("%d %d",&a,&b);printf("大數是:%d\n",max(
Time of Update: 2015-04-23
標籤:// 輸入a,b,c三個值,輸出其中最大者#include <stdio.h>int max( int a, int b, int c ){int temp;if( a > b && a > c )temp = a;if( b > a && b > c )temp = b;if( c > a && c > b )temp = c;return temp;}int main(){int
Time of Update: 2015-04-24
標籤:C++中sizeof是經常被問到的一個概念,比如,下面的幾個關於sizeof的面試題反覆出現在各大IT公司的技術面試當中,我們有必要完全理解並掌握。註:在曾經面試大公司時,我的確被問到過這樣的問題。面試題:定義一個空的資料類型,裡面沒有任何成員變數和成員函數,對該類型求sizeof,得到的結果是多少?答案:是1,為什麼不是0?空類型的執行個體中不包含任何資訊,本來求sizeof應該是0,但是當我們聲明該類型的執行個體時,它必須在記憶體中佔有一定的空間,否則無法使用這些執行個體(也就不能求s
Time of Update: 2015-04-23
標籤:隱藏:是指衍生類別的函數屏蔽了與其同名的基類函數,規則如下:(1)如果衍生類別的函數與基類的函數同名,但是參數不同。此時,不論有無virtual關鍵字,基類的函數將被隱藏(注意別與重載混淆)。 很簡單略去(2)如果衍生類別的函數與基類的函數同名,並且參數也相同,但是基類函數沒有virtual關鍵字。此時,基類的函數被隱藏(注意別與覆蓋混淆)。 1 #include <iostream> 2 using namespace std; 3
Time of Update: 2015-04-23
標籤:譯密碼// 將“China”譯成密碼,密碼規律:用原來字母后邊第4個字母代替原來的字母。// 要求:先賦初值,然後分別用putchar和printf輸出#include <stdio.h>int main(){char c1 = 'C';char c2 = 'h';char c3 = 'i';char c4 = 'n';char c5 = 'a';c1 = c1 + 4;c2 = c2 + 4;c3
Time of Update: 2015-04-24
標籤:effective c++ 《Effective
Time of Update: 2015-04-23
標籤:注意:C++中double的表示是有誤差的,直接通過下面的例子看一下 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 double i; 6 for(i=0;i!=10;i+=0.2) 7 { 8 cout<<i<<endl; 9 }10 return 0;11
Time of Update: 2015-04-23
標籤:mfc 視窗風格 視窗樣式 擴充風格 擴充樣式 視窗風格(Window style)WS_BORDER 有邊框視窗 WS_CAPTION 必須和WS_BORDER風格配合,但不能與WS_DLGFRAME風格一起使用。指示視窗包含標題要部分。 WS_CHILD
Time of Update: 2015-04-21
標籤:樣本來源 :msdn 1.0 迭代器簡單的迭代器: public static void Main(string[] args) { foreach (int number in EvenSequence(5, 18)) { Console.Write(number.ToString() + " "); }
Time of Update: 2015-04-21
標籤:#include<iostream>using namespace std;class Test{private:const int a; //const 成員變數只能在建構函式的成員初始化列表中初始化,不能在函數體中和其他地方static int b; //static 成員變數需要在全域範圍內初始化,格式: 類型名 類名::變數名 = 值static const int c;//static const
Time of Update: 2015-04-19
標籤:字串的基本使用定義方法:char name[10] ="jack"; 此時字串中共包含‘j’,’a‘,‘c‘,‘k‘,‘\0‘中括弧中的10代表該字串最多存放10個字元字串的輸出1.printf("jack");2.printf(name);
Time of Update: 2015-04-19
標籤: 1 #include<iostream> 2 #include<cstdlib> 3 4 struct node 5 { 6 7 int data; 8 node* next; 9 10 }; 11 12 class Stack 13 { 14 15 public: 16 17 node* head; 18 19 Stack(void); 20 ~Stack(); 21 22
Time of Update: 2015-04-26
標籤:c#修改註冊表,需要引用Microsoft.Win32命名空間using Microsoft.Win32; //聲明 ///引用 RegistryKey reg; reg = Registry.ClassesRoot; 以下從‘讀’‘寫’‘刪除’‘判斷’四個案例實現對註冊表的簡單操作 1.讀取指定名稱的註冊表的值 private string GetRegistData(string
Time of Update: 2015-04-23
標籤:C#隨機函數Random()的用法出自:http://www.cnblogs.com/wang726zq/archive/2012/04/28/2474711.htmlhttp://blog.csdn.net/xianxianmohan/article/details/6587909http://www.cnblogs.com/falla/archive/2010/01/29/1659399.htmlhttp://blog.csdn.net/pfe_nova/article/details
Time of Update: 2015-04-23
標籤:This resolved the issue for me. Your code becomes:public Excel.Application excelApp = new Excel.Application();public Excel.Workbooks workbooks;public Excel.Workbook excelBook;workbooks = excelApp.Workbooks;excelBook = workbooks.Add(@"C:/pape.xltx"
Time of Update: 2015-04-22
標籤:1:通過設定表單的 TransparencyKey實現 例:表單中的白色會變成透明 this.BackColor =Color.White; this.TransparencyKey = Color.White; TransparencyKey只支援透明或不透明,不支援過度色,比如PNG圖片中的從不透明到透明的過渡色會顯示出討厭的效果2:通過設定表單的 Opacity 實現
Time of Update: 2015-04-27
標籤:c一、枚舉定義:枚舉是 一種使用者定義的資料類型,它用的關鍵字 enum 枚舉類型名字通常並不真的使用,要用的是在大括弧裡地名字,因為它們就是常量符合,它們的類型是int,值則依次從0到n。 enum colors {red, yellow, green}文法:enum 枚舉類型名稱{名字0m, ..., 名字n};案例一:自動計數的枚舉//// main.c//