Time of Update: 2015-03-18
標籤:介面 聲明 設計 18.讓介面容易被正確使用問題:介面的參數介面依賴其他調用class Date {public: Date(int month,int day, int year;}以上代碼問題:容易以錯誤的順序傳遞參數可能傳遞無效的月份或天數 解決方案:通過匯入新類型獲得預防struct Day { explicit Day(int):val(d){} int
Time of Update: 2015-03-18
標籤:快速排序 遞迴 非遞迴 非遞迴:#include <stdio.h>#include <stdlib.h>int partition(int s[], int i, int j){int value = 0;int flag = 1; //判斷該從頭迴圈還是尾迴圈value = s[i];while(i<j){switch(flag){case 0:if(s[
Time of Update: 2015-03-18
標籤:向原創致敬http://blog.csdn.net/janeky/article/details/17104877 一個遊戲包含了各種資料,包括本機資料和與服務端通訊的資料。今天我們來談談如何儲存資料,以及用戶端和服務端的編碼方式。根據以前的經驗,我們可以用字串,XML,json...甚至可以直接儲存二進位。各種方式都有各自的優劣,有些效能比較好,但是實現方式比較麻煩。有些資料冗餘太多。簡介今天我們來學習一種廣泛使用的資料格式:Protobuf。簡單來說,它就是一種二進位格式,是
Time of Update: 2015-03-18
標籤:一.C/C++之初學Demo、C++調用C、.h檔案使用執行個體:工程結構:exercise.h code:1 #ifndef _EXERCISE_H_2 #define _EXERCISE_H_3 #include <externcpp.h>;4 extern "C" 5 { 6 #include <externc.h>;7 }8 #endifexternc.h code:1 #ifndef _EXTENC_H_2 #define _EXTENC_H_
Time of Update: 2015-03-17
標籤:c++11 lambda auto
Time of Update: 2015-03-18
標籤:14152學年C#程式設計語言與.Net架構基礎課程之學生blog名單 student_idnametgrademajortclassdirectionBlogs3013211039劉暢2013軟體工程3 www.cnblogs.com/tju-liuchang3013218046陳曉龍2013軟體工程1 www.cnblogs.com/tiny-home3013218047高鐘燁2013軟體工程1 www.cnblogs.com/tjufengye301
Time of Update: 2015-03-18
標籤:1 const對象預設為檔案的局部變數(P50)a.cppconst int a = 1;b.cppextern int a;//undefined reference to "a"a.cppint a = 1;b.cppextern int a;//OKa.cppextern const int a = 1;b.cppextern int a;//OK即非const變數預設為extern,const變數要在其他檔案中被訪問,必須顯式指定為extern2
Time of Update: 2015-03-17
標籤:1、變數交換 1 #include<stdio.h> 2 int main() 3 { 4 void swap(int *a,int *b); //聲明swap函數 5 int x=3,y=4; 6 swap(&x,&y); 7 printf("%d,%d\n",x,y); 8 getch(); 9 }10 void swap(int *a,int *b)11 {12 int c;13 c=*a;14 *a=*b;15
Time of Update: 2015-03-18
標籤:轉自:http://blog.csdn.net/hackbuteer1/article/details/7460019 單例模式其意圖是保證一個類僅有一個執行個體,並提供一個訪問它的全域訪問點,該執行個體被所有程式模組共用。《設計模式》一書中給出了一種很不錯的實現,定義一個單例類,使用類的私人靜態指標變數指向類的唯一執行個體,並用一個公有的靜態方法擷取該執行個體。class CSingleton{private: CSingleton() //建構函式是私人的 {
Time of Update: 2015-03-18
標籤:1 下載apache程式 apache連結:http://archive.apache.org/dist/httpd/binaries/win32/httpd-2.2.21-win32-x86-no_ssl.msi2 程式:#include<stdio.h>int main(int argc,char*argv[]){printf("Content-type:text/html\n\n");//注意:必須要有2個\nprintf("hello world");return 0;
Time of Update: 2015-03-18
標籤:include 程式員 關鍵字 c語言 運算式 ------- IOS培訓期待與您交流!
Time of Update: 2015-03-18
標籤:
Time of Update: 2015-03-18
標籤:c# 擷取本機 內網 外網 ip using System.Net; //擷取本地ip地址 public String GetLocalIpAddress() { IPAddress[] names =
Time of Update: 2015-03-18
標籤:public static string getSystemName() { ManagementClass mc = new ManagementClass("Win32_OperatingSystem"); ManagementObjectCollection moc = mc.GetInstances(); String systemType = ""; foreach
Time of Update: 2015-03-18
標籤:一:在源碼管理器中開啟VS 注意,下文這樣的開啟檔案是在 TFS 的源碼伺服器中開啟解決方案。如果我們使用 SVN,則直接在硬碟上開啟解決方案就可以了。 開啟VS: 然後按中的步驟1和2(雙擊2處),開啟我們的解決方案,如下: 注意,雙擊紅框,會顯示Solution Explorer。 我們在上一節中,只是建立了打老鼠的解決方案,還完全沒有編寫任何代碼。這個時候運行解決方案一下(記得嗎,菜單中Debug->Start without
Time of Update: 2015-03-18
標籤:C#:STRING.FORMAT數字格式化輸出 1.各種常用數字格式化貨幣轉換 C 或 c(預設小數點後2位。C3後面跟的數字就代表小數後幾位) string.Format("{0:C}",a)<==>a.ToString("C")//$2.50 string.Format("{0:C3}",a)<==>a.ToString("C3")//$2.500轉換為十進位數 D 或 d a=2
Time of Update: 2015-03-18
標籤:financial markets c# 資料 金融 建立AssocArray的目的是關聯資料和主鍵:例如"A1" ~ 1; "B1" ~ 2.08 ...其中,Set是自訂的資料結構,內部含有dictionary資料,可以進行諸如合并,交集等的操作。using System;using
Time of Update: 2015-03-17
標籤:c#操作excel今天用了近一天的時間來完成和學習,和大家分享如下:網上有用外掛程式的方法,我是用COM組件C#操作Excel檔案:1.在程式裡建立Excel檔案2.在程式裡對已有的Excel檔案修改資料前提:using MSExcel = Microsoft.Office.Interop.Excel;using System.Reflection;using System.IO;備忘:第一個指令集會報錯,需要添加引用COM下的Office和Excel功能一:在程式裡建立Excel檔案//
Time of Update: 2015-03-18
標籤: 在開發過程中需要做一個動畫,使用的是一個寬高比為1:2的長方形圖片,形態是一個框子;想使它按照1:1寬高比從指定大小放大到一定倍數。 最開始使用的方法:local frm = display.newSprite(‘#frm.png‘) --寬高比為1:2的長方形框子local frmSize = frm:getContentSize()local iconw, iconh = 100, 100local scale = 2.5 --預期放大倍數local time = 0.2
Time of Update: 2015-03-17
標籤:先上兩個解釋我的疑惑的連結:http://en.cppreference.com/w/cpp/language/operator_arithmetichttps://msdn.microsoft.com/en-us/library/3t4w2bkb.aspx 開始我是看 <<Expert C programming -- Deep C Secrets>>這本書(中文譯作 C專家編程), chapter 1 裡面的how quite is a quite