Time of Update: 2015-06-21
標籤:一 數組 1一維數組 //統計每一個學產生績並計算全班10人的平均成績,然後把所有成績顯示出來 double[] score = new double[10]; double sum = 0; for (int i = 0; i < 10; i++) { Console.WriteLine("請輸入學產生績:"); score[
Time of Update: 2015-06-22
標籤:絕不在構造和析構過程中調用virtual函數本節有個核心的知識點就是在建構函式和解構函式中,virtual函數失去多態性。 試想一下,假設此時在建構函式和解構函式中,virtual函數沒有失去多態性,會出現什麼問題。我們知道構造次序吧,先構造base類部分,再構造derived部分。
Time of Update: 2015-06-22
標籤: 多態是指使用相同的函數名來訪問函數不同的實現方法,即“一種介面,多種方法”,用相同的形式訪問一組通用的運算,每個運算可能對應的行為不同。 C++支援編譯時間多態和運行時多態,運算子多載和函數重載就是編譯時間多態,而衍生類別和虛函數實現運行時多態。 1、運行時多態: class A
Time of Update: 2015-06-22
標籤:基類為多態基類聲明virtual解構函式本節重點大家只要明白為什麼要聲明解構函式為virtual函數,即聲明virtual解構函式的意義。我們知道,解構函式的作用就是實現多態polymorphic。那麼如果我們動態建立一個derived衍生類別,由基類指標接受該衍生類別地址。那麼我們如何釋放這個衍生類別的記憶體? 如下代碼:class A{//...........};class B:public A{//.................};A* a=new B;delete
Time of Update: 2015-06-20
標籤:1--》printf()輸出的時候前面沒有0 是十進位,前面帶0是八進位,前面有0x是十六進位 printf("%d",100):十進位解析 printf("%d",0100):八進位解析 printf("%d",0x1231):十六進位解析2--》關於佔位 各類型占的位元和機器字長及編譯器有關係: 所以,int,long int,short int的寬度都可能隨編譯器而異。但有幾條鐵定的原則(ANSI/ISO制訂的): 1 sizeof(short
Time of Update: 2015-06-20
標籤:acm 不知道說什麼 c++ hdu 水題 Moving TablesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 231
Time of Update: 2015-06-19
標籤:(內容主要源於網上,只是加入了些自己的剖析)假設有一個二重指標:char **p;同時有一個指標數組char *name[4];如何引用p呢? 首先我們有程式碼如下 #include <stdio.h> int main() { char *s = "I love you"; char *s1 = "you love me"; char *s2 = "she love you"; char *s3 = "he love her";
Time of Update: 2015-06-18
標籤:關鍵字:std::string Unicode轉自:http://www.vckbase.com/document/viewdoc/?id=1293 一旦知道 TCHAR 和_T 是如何工作的,那麼這個問題很簡單。基本思想是 TCHAR 要麼是char,要麼是 wchar_t,這取決於_UNICODE 的值: 1: // abridged from tchar.h 2: 3: #ifdef _UNICODE 4:
Time of Update: 2015-06-19
標籤:適合大量檔案資料#include <iostream>using namespace std;class MaxHash{public: MaxHash(int n) { data = new int[n]; size = n; } void Insert(int a[], int n) { int i = 0; for (; i < size; i++)//初始化數組 {
Time of Update: 2015-06-18
標籤: 1 #include<iostream> 2 using namespace std; 3 class Complex{ 4 public: 5 Complex(double r=0.0,double i=0.0):real(r),imag(i){} 6 friend Complex operator + (const Complex &c1,const Complex &c2); 7 friend Complex operator -
Time of Update: 2015-06-19
標籤:數組#include <iostream>using namespace std;void InitIt(int b[],int n)//插入排序{ int j = n; int flags = j - 1; if (flags<0)return; for (; flags >= 0; flags--) { if (b[j] > b[flags])
Time of Update: 2015-06-19
標籤:機器學習演算法與Python實踐之(三)支援向量機(SVM)進階機器學習演算法與Python實踐之(三)支援向量機(SVM)進階[email protected]http://blog.csdn.net/zouxy09
Time of Update: 2015-06-19
標籤: 近期,幫朋友做個小軟體,需要用到資料庫和Excel的讀寫操作,關於資料庫的CRUD就不說了,只說一點:XP和Win7對於Environment.CurrentDirectoty的識別居然不一致,導致使用了OpenDialog後,資料庫經常找不到。 Excel的讀寫操作,涉及到左下角的Excel表格中的表名識別問題,有的是“Sheet1”,有的是“工作表1”,這個問題可以使用如下方法解決: OleDbConnection OleConn = new
Time of Update: 2015-06-19
標籤:C# 通過HTTP代理訪問Socket來擷取郵件關鍵穿透代理的代碼(通過HTTP代理擷取TcpClent)public class ClientHelper { public static TcpClient connectViaHTTPProxy( string targetHost, int targetPort, string httpProxyHost, int
Time of Update: 2015-06-21
標籤:推方塊小遊戲 很有意思的小遊戲 mooc 有代碼 我還是自己打了一遍 熟悉下C# 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using
Time of Update: 2015-06-18
標籤:靜態建構函式是C#的一個新特性,其實好像很少用到。不過當我們想初始化一些靜態變數的時候就需要用到它了。這個建構函式是屬於類的,而不是屬於哪裡執行個體的,就是說這個建構函式只會被執行一次。也就是在建立第一個執行個體或引用任何靜態成員之前,由.NET自動調用。 // Static constructor static SimpleClass() {
Time of Update: 2015-06-22
標籤:C. Registration systemTime Limit: 20 SecMemory Limit: 256 MB題目串連http://codeforces.com/problemset/problem/4/CDescriptionA new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch
Time of Update: 2015-06-19
標籤:作業系統 驅動程式 bsp sylixos 此篇部落格為 SylixOS ARM BSP 編寫連載的第三篇,主要介紹 bspInit.c 檔案具體實現。bspInit.c 為 BSP 作業系統初始化部分代碼,通常由 startup.S 初始完基本處理器參數後調用,下面以 S3C2440A 處理器為例,逐塊介紹 bspInit.c
Time of Update: 2015-06-19
標籤:#include <stdio.h>#include <string.h>//尋找該元素是否已經存在int find(char t[],int len,char ch){int i;for(i = 0; i < len; i++){if (t[i] == ch){return 1;}}return 0;}char *CompressStr(char s[]){char t[255];int i = 0,j,k=0,count=1;while(s[i]){j =
Time of Update: 2015-06-19
標籤: 題目傳送門 1 /* 2 題意:問是否能用品質為w^0,w^1,...,w^100的砝碼各1個稱出重量m,砝碼放左邊或在右邊 3 暴力/進位轉換:假設可以稱出,用w進位表示,每一位是0,1,w-1。w-1表示砝碼與物品放在一起,類比判斷每位是否ok 4 詳細解釋:http://blog.csdn.net/u011265346/article/details/46556361 5