Time of Update: 2015-05-07
標籤:c++ 模板 類 max //用函數模板實現不同類型的兩個數比較大小#include <iostream>using namespace std;template <class mytype> //定義函數模板class Max{public:Max(mytype a, mytype b){x=a;y=b;} mytype
Time of Update: 2015-05-07
標籤:c++ primer第四版#include <iostream>#include <vector>int main(){ std::vector<int> ivec; int temp; while(std::cin>>temp) ivec.push_back(temp); int *cp =new int[ivec.size()];
Time of Update: 2015-05-06
標籤:動態數組(ArrayList)代表可單獨被索引的對象的集合。動態數組可以自動調整大小。允許動態記憶體的分配,怎加,搜尋,排序。using System;using System.Collections;namespace CollectionApplication{ class Program { static void Main(string[] args) { ArrayList al = new ArrayList();
Time of Update: 2015-05-06
標籤: 10402: C.機器人DescriptionDr. Kong 設計的機器人卡爾非常活潑,既能原地蹦,又能跳遠。由於受軟硬體設計所限,機器人卡爾只能定點跳遠。若機器人站在(X,Y)位置,它可以原地蹦,但只可以在(X,Y),(X,-Y),(-X,Y),(-X,-Y),(Y,X),(Y,-X),(-Y,X),(-Y,-X)八個點跳來跳去。現在,Dr.
Time of Update: 2015-05-07
標籤://希爾排序#include<iostream>#include<array>using namespace std;template<class T>void shell_sort(T&, int);int main(){ array<int, 10> arr = {1,2,3,5,4,6,7,8,9,0}; shell_sort(arr, arr.size()); &
Time of Update: 2015-05-06
標籤:OS:Windows 7關鍵字:VS2012,C++,VTable,虛表 1.建立一個Win32控制台應用程式代碼如下:#include "stdafx.h"#include <string>#include <iostream>class A{public: virtual std::string AName(){return "A";}};class B{public: virtual std::string BName(){return
Time of Update: 2015-05-06
標籤:c++ string wstring 1、wstring 轉換為string#include <string>std::string ws2s(const std::wstring& ws){ std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = "C";
Time of Update: 2015-05-06
標籤://⒈ 從第一個元素開始,該元素可以認為已經被排序//⒉ 取出下一個元素,在已經排序的元素序列中從後向前掃描//⒊ 如果該元素(已排序)大於新元素,將該元素移到下一位置//⒋ 重複步驟3,直到找到已排序的元素小於或者等於新元素的位置//⒌ 將新元素插入到下一位置中//⒍ 重複步驟2~5#include<iostream>#include<array>using namespace std;template<class T>void
Time of Update: 2015-05-04
標籤:mapwingis
Time of Update: 2015-05-05
標籤:C#的枚舉類型跟C++差不多,一般我們將enum設為單個狀態,比如enum color_t { RED, BLACK, GREEN}, 只能選擇一個而有的時候枚舉可以作為位元運算來進行與或運算,比如ControlStyles這個枚舉,看下面一段從TabControlEx中的一段代碼1 base.SetStyle(2 ControlStyles.UserPaint |3
Time of Update: 2015-05-05
標籤:cocos2d-x cocos2d-x3.x 2048 遊戲 c++11 話說,年僅19歲的意大利人Gabriele Cirulli於2014年3月完成並發布在github上,遊戲設計來自於《1024》,而《1024》靈感來源於《Threes!》的移動端遊戲。然而遊戲飆升的人氣超乎他的想象,人們忘記了Flappy
Time of Update: 2015-05-07
標籤:mono 開原始碼 c# Mono 4.0 伴隨著C# 6發布 Mono 4.0這個月正式發布。這是微軟CoreCLR項目中包含開原始碼的第一個版本。它也是C# 6預設的,意味著Mono再一次比微軟提前擁有一個新的C#編譯器的RTM版本。 除了我們之前報道過的功能和變化,Mono 4
Time of Update: 2015-05-06
標籤:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Drawing.Imaging;using System.Text;using System.Windows.Forms;using System.Threading;using System.Diagnostics;using
Time of Update: 2015-05-07
標籤:using System;using System.IO;namespace ConsoleApplication2{ delegate void D(int x); class Program { static void Main(string[] args) { D cd1 = new D(C.M1); cd1(-1);
Time of Update: 2015-05-06
標籤:【實值型別在裝箱過程中內部發生的事情】1. 在託管堆中分配好記憶體。分配的記憶體量是實值型別的各個欄位需要的記憶體量加上託管堆的所有對象都有的兩個額外成員(類型對象指標和同步快索引)需要的記憶體量。2.實值型別的欄位複製到新分配的堆記憶體。3.返回對象的地址。現在,這個地址是對一個對象的引用,實值型別現在是一個參考型別。讀經典——《CLR via C#》(Jeffrey Richter著) 筆記_實值型別的裝箱和拆箱(一)
Time of Update: 2015-05-05
標籤: WebRequest 是 .NET Framework 的請求/響應模型的abstract 基類,用於訪問 Internet 資料。 使用該請求/響應模型的應用程式可以用協議不可知的方式從 Internet 請求資料,在這種方式下,應用程式處理 WebRequest 類的執行個體,而協議特定的子類則執行請求的具體細節。using System;using System.IO;using
Time of Update: 2015-05-05
標籤:【checked 和 unchecked 基元類型操作】1.第一種使用方式UInt32 invalid = unchecked((UInt32) (-1)); //OK,不會拋異常Byte b = 100;b = checked((Byte) (b + 200));//拋出OverflowException異常2.第二種使用方式checked {//開始一個checked塊 Byte b = 100; b = (Byte) (b + 200);
Time of Update: 2015-05-05
標籤:---------------變數和運算式---------------賦值運算子:+=;-=;*=;/=;%=例如:i+=j 相當於 i=i+j i-=j 相當於 i=i-j以此類推 按位元運算符:&——與;|——或;^——異或;~——取反;>>——向右位移;<<——向左位移 例如:5的二進位表示為00000101
Time of Update: 2015-05-05
標籤: 通過 System.Reflection 命名空間中的類以及System.Type,您可以擷取有關已載入的程式集和在其中定義的類型(如類、介面和值類型)的資訊。您也可以使用反射在運行時建立類型執行個體,以及調用和訪問這些執行個體。
Time of Update: 2015-05-05
標籤: