Time of Update: 2015-04-15
標籤: 1 #include <stdio.h> 2 #include <tchar.h> 3 4 char* UnicodeToAnsi( const wchar_t* szStr ) 5 { 6 int nLen = WideCharToMultiByte( CP_ACP, 0, szStr, -1, NULL, 0, NULL, NULL ); 7 if (nLen == 0) 8 { 9 return NULL; 10 } 11
Time of Update: 2015-04-15
標籤:c++ 閏年判斷 星期計算 switch 源碼 /*通過輸入年月日,計算出這一天是星期幾,計算這一天是這一年的多少天,判斷這一年是否為閏年*/#include<iostream>using namespace std;struct time{int year;int month;int
Time of Update: 2015-04-14
標籤:何謂初始化列表與其他函數不同,建構函式除了有名字,參數列表和函數體之外,還可以有初始化列表。初始化列表以冒號開頭,後跟一系列以逗號分隔的初始化欄位。在C++中,struct和class唯一的區別就是struct的所有成員預設都是public的,所以如果不考慮成員的可訪問性,這兩者是沒有區別的,而這裡我們不考慮訪問性的問題,所以下面的代碼都以struct來示範。struct foo{ string name ; int id ; foo(string s,
Time of Update: 2015-04-13
標籤:c語言定義:#define EXAMPLE(x) printf("x = %d", x) i = 10; j = 11;EXAMPLE(i)EXAMPLE(j)i = 20; j = 21;EXAMPLE(i)EXAMPLE(j)輸出:x = 10x = 11x = 20x = 21這個輸出不是我們要的效果。修改宏定義中 printf 的使用。#define EXAMPLE(x) printf( #x" = %d", x) 輸出:i = 10j = 11i = 20j
Time of Update: 2015-04-14
標籤:二維數組 c# C#中有多維陣列和交錯數組,兩者有什麼區別呢! 直白些,多維陣列每一行都是固定的,交錯數組的每一行可以有不同的大小。 以二維的舉例,二維數組就是m×n的矩陣,m行n列;而交錯數組(又叫鋸齒數組)有m行,但是每一行不一定是n列。Got it? 還有要注意C#中的數組也是一種類型(C++中不是)! 下面看執行個體: 二維數組:public static void Main(){ int row = 5;
Time of Update: 2015-04-14
標籤:現在網上搜到的快排和我以前打的不太一樣,感覺有點複雜,我用的快排是FreePascal裡/demo/text/qsort.pp的風格,感覺特別簡潔。 1 #include<stdio.h> 2 #define MAXN 10000 3 int a[MAXN]; 4 int n; 5 void Mysort(int l, int r) { 6 int x,y,mid,t; 7 mid = a[(l+r)/2]; 8 x=l; 9 y=r;10
Time of Update: 2015-04-13
標籤:shell排序的方法又稱縮小增量法,是對直接插入排序法的改進。至於對於分組後採用哪種排序方法實現,本例採用直接選擇排序和直接插入排序,理論上講,通過分組排序後,資料基本上有序,這時通過直接插入排序會比直接選擇排序好,因為直接選擇排序每一趟排序都必須比較所有的元素。具體代碼如下:/* *shell排序*/#include <stdio.h>#define N 10void shellChoice(int *list){ int
Time of Update: 2015-04-12
標籤:重載 覆蓋 隱藏 多態性 繼承 C++中經常用到重載、覆蓋和隱藏這三個概念,也經常容易搞混。所以,這篇博文來整理一下它們之間的異同。1. 重載——實現多態性 A.相同的範圍(同一個類中) B.函數的名字相同 C.參數類型不同(不能進行隱式類型轉換) D.Virtual關鍵字可有可無2.
Time of Update: 2015-04-12
標籤:一個難度為Easy的題,看了好多人的題解都沒想明白,最後使勁想使勁想,才想的差不多。。太弱了,要找不到工作了。。題目描述:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P
Time of Update: 2015-04-12
標籤://合并排序#include <iostream>#include <iomanip>using namespace std;void sort(int c[],int a[],int b[],int n){int i=0;int j=0;//aint k=0;//bwhile(k!=5 &&
Time of Update: 2015-04-12
標籤:c++ class 二維數組 namespace /* Copyright (c) 2014, 煙台大學電腦學院 * All rights reserved. * 檔案名稱:test.cpp * 陳丹妮 * 完成日期:2015年 4 月 11 日 * 版 本 號:v1.0
Time of Update: 2015-04-15
標籤:using System;using System.Threading;using System.Runtime.Remoting.Messaging;using System.Collections.Generic;namespace PurchaseSystem.Component{ public enum FlowType { CaiGou, YingFu } public delegate void
Time of Update: 2015-04-14
標籤:概念GUID: 即Globally Unique Identifier(全球唯一識別碼) 也稱作 UUID(Universally Unique IDentifier) 。 GUID是一個通過特定演算法產生的二進位長度為128位的數位識別碼符,用於指示產品的唯一性。GUID 主要用於在擁有多個節點、多台電腦的網路或系統中,分配必須具有唯一性的標識符。 在 Windows 平台上,GUID
Time of Update: 2015-04-15
標籤: 1 #region 儲存檔案 2 public void SaveFile(StringBuilder strHtml) 3 { 4 string tpxxID = Request.QueryString["FBWZID"]; 5 try 6 { 7 Model.TP_TPXX&n
Time of Update: 2015-04-13
標籤:類的完整代碼:using System;using System.Collections;using System.Xml;namespace Keleyi.Com.XmlDAL{public class XmlHelper{#region 公開變數XmlDocument xmldoc;XmlNode xmlnode;XmlElement xmlelem;#endregion#region 建立Xml文檔/// <summary>/// 建立一個帶有根節點的Xml檔案/// &
Time of Update: 2015-04-13
標籤:前提:在我們的域環境下,給分配了管理員層級兩個帳號(user0,user1)。需求:只允許一個賬戶運行進程"WindowsFormsApplication1": 1,)當已經運行“WindowsFormsApplication1”且運行賬戶不是自己的賬戶,就需要提示該進程是被誰佔用;
Time of Update: 2015-04-13
標籤:第一種方式:System.Diagnostics.Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 開始監視代碼已耗用時間// 需要測試的代碼 ....stopwatch.Stop(); // 停止監視TimeSpan timespan = stopwatch.Elapsed; // 擷取當前執行個體測量得出的總時間double hours = timespan.TotalHours; // 總小時double
Time of Update: 2015-04-15
標籤:C - 娜娜夢遊仙境系列——吃不完的糖果Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)Problem
Time of Update: 2015-04-15
標籤:題意:給你一個序列 ,讓你求這個序列組成哈夫曼樹的 WPL解題思路:優先隊列直接搞。因為數太大,用了非遞迴求解。解題代碼: 1 #pragma comment(linker, "/STACK:1024000000,1024000000") 2 // File Name: c.cpp 3 // Author: darkdream 4 // Created Time: 2015年04月14日 星期二 18時35分42秒 5 6 #include<vector> 7
Time of Update: 2015-04-13
標籤:主要是應用了標頭檔<string.h>中的strstr函數char * strstr(const char *s1, const char *s2); 尋找是否存在: 1 #include<stdio.h> 2 #include<string.h> 3 int main(void) 4 { 5 char str3[] = {"abcabcdababc"}; 6 char str4[] = "abc",*b; 7