Time of Update: 2018-12-04
本文示範C#計時器:Stopwatch的使用。 頁面代碼:<Window x:Class="TestStopwatch.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow"
Time of Update: 2018-12-04
typedef struct _st{int a;int b;char c;}st;struct _struTest{short sh;long ln;}struTest;int _tmain(int argc, _TCHAR* argv[]){char arr[] = "123456789";char *p1 = "12345";char *p2 = arr;int iNum = 10;printf("sizeof(arr) = %d/n", sizeof(arr)); //
Time of Update: 2018-12-04
讀入一段文本到vector對象,每個單詞儲存為vector的一個元素。把vector對象中每個單詞轉化為大寫字母。輸出vector對象中轉化後的元素,每八個單詞為一行輸出#include "stdafx.h"#include <iostream>#include <fstream>#include <vector>#include <string>using namespace std;int main(){vector<string>
Time of Update: 2018-12-04
c語言 curl前兩天看到有人求用戶端socket 發HTTP包的代碼,受flw版主啟發找了一些perl的資料,不過對perl 還是不太熟悉。也沒有深入的研究。無意中發現了libcurl.so 這個庫。去google上搜尋發現它是處理用戶端發送HTTP請求的庫 以及可以處理web伺服器回送回來的包。研究了兩天將研究的成果,共用出來給大家一起研究。參考:http://curl.haxx.se/ 這是curl開發人員的首頁。 利用libcurl.so庫
Time of Update: 2018-12-04
#include <windows.h>#include <TLHELP32.H> //申明快照函數的標頭檔int main(int argc, char *argv[]){ PROCESSENTRY32 pe32; HANDLE hProcessSnap; BOOL bMore; //在使用這結構前,先設定其大小 pe32.dwSize = sizeof(pe32); //給系統的所有進程拍一個照 hProcessSnap =
Time of Update: 2018-12-04
c++11中一個最重要的特性就是加入了多線程的支援,並定義了c++的memory model。memory model定義了一個處理器上對記憶體的操作如何被其他處理觀察到,The memory model, or memory consistency model, specifies the values that a shared variable read in a multithreaded program is allowed to return.上面的定義出自Foundation
Time of Update: 2018-12-04
應用了遞迴方法#include<iostream>//該程式是移動漢諾塔程式using namespace std;int main(){ void hanoi(int n,char one,char two,char three); int m; cout<<"input the number of disks:"; cin>>m; cout<<"The steps of moving"<<m<<"disks:"<&
Time of Update: 2018-12-04
C++學習中遇到的問題,記錄之。使用的教材: 《C++ primer》。智能指標?what? how?What ‘s the smartpointer and how to impletment
Time of Update: 2018-12-04
資料庫儲存了幾乎所有的業務資料,而這些資料畢竟不是靜態,那麼就必然需要我們來寫程式完成資料的加工和整合,資料庫僅僅儲存我們加工整合後的結果,因此必然的,我們需要把資料庫中的資料讀到程式中,然後加工後再存入資料庫,同樣必然的,我們需要在程式中鑑效組資料庫表的結構,那麼很顯然,我們需要在程式中定義很多結構體或者聯合體數組來儲存資料庫查詢的結果,每個結構體代表了一個紀錄,很多紀錄就用結構體數組來表示,如此一來,程式就會顯得很臃腫,比如會出現下列的結構體:struct girl { char
Time of Update: 2018-12-04
http://www.cnblogs.com/nelson-tu/archive/2006/02/08/327227.html l .NET Reflector是一個類瀏覽器和反編譯器,利用反射機制來剖析器集,以展示程式集中各種類型及其成員的資訊。 l 下載.NET Reflector:http://www.aisto.com/roeder/dotnetl
Time of Update: 2018-12-04
下文轉自:http://software.intel.com/zh-cn/blogs/2010/05/04/c-2/ 剛開始學習c++的人都會遇到這樣的問題:定義一個類 class
Time of Update: 2018-12-04
C++:介面繼承和實現繼承(public) inheritance 這個表面上簡單易懂的觀念,一旦被近距離審視,就會被證明是由兩個相互獨立的部分組成的:inheritance of function interfaces(函數介面的繼承)和inheritance of function implementations(函數實現的繼承)。這兩種inheritance 之間的差異正好符合本書 Introduction 中論述的 function declarations(函式宣告)和
Time of Update: 2018-12-04
1. 重載、覆蓋與隱藏 1).重載:成員函數具有以下的特徵時發生"重載" A.相同的範圍(同一個類中) B.函數的名字相同 C.參數類型不同(不能進行隱式類型轉換) D.Virtual關鍵字可有可無 2).覆蓋(也叫"繼承"):指衍生類別函數覆蓋基類函數,特徵是: A.不同的範圍(分別位於基類與衍生類別中) B.函數名字相同 C.參數相同 D.基類函數必須有virtual關鍵字 3).隱藏:是指衍生類別的函數屏蔽了與其同名的基類函數,規則如下:
Time of Update: 2018-12-04
#include <windows.h>#include <string.h>#include <stdio.h>int main(int argc, char* argv[]){ char szCommandLine[] = "cmd"; STARTUPINFO si = {sizeof(si)}; BOOL bRet; PROCESS_INFORMATION pi; //指定顯示ShowWindows有效 si.dwFlags =
Time of Update: 2018-12-04
#include <windows.h>#include <stdio.h>//線程函數DWORD WINAPI ThreadProc(LPVOID lpParam){ int i = 0; while(i < 20) { printf("I am from a thread,count = %d/n",i++); } return 0;}int main(int argc, char* argv[]){ HANDLE hThread; DWORD
Time of Update: 2018-12-04
本來寫著原創的,不過現在想想,不應該說是原創,其實代碼都是在前人的基礎上改的。 不過我改的時候,找了好多資料,好不容易才完成的,用VC6。0編譯通過了,現在把源碼發出來,這個比較簡單的,初學者看是最好的了,因為我也是初學者了。#include <winsock2.h>#include <stdio.h> //printf函數要用的標頭檔#pragma comment(lib,"ws2_32.lib")void Help(); //申明協助函數int
Time of Update: 2018-12-04
#include <stdio.h>#include <string.h>#include <winsock2.h>#pragma comment(lib,"ws2_32")void scan1(char *);void scan2(char *,char *,char *);void usage(char *);int main(int argc,char *argv[]){if(argc != 2 && argc != 4)
Time of Update: 2018-12-04
一.先來說說數組的不足(也可以說集合與數組的區別):1.數組是固定大小的,不能伸縮。雖然System.Array.Resize這個泛型方法可以重設數組大小,但是該方法是重新建立新設定大小的數組,用的是舊數組的元素初始化。隨後以前的數組就廢棄!而集合卻是可變長的2.數組要聲明元素的類型,集合類的元素類型卻是object.3.數組可讀可寫不能聲明唯讀數組。集合類可以提供ReadOnly方法以唯讀方式使用集合。4.數組要有整數下標才能訪問特定的元素,然而很多時候這樣的下標並不是很有用。集合也是資料列表
Time of Update: 2018-12-04
運算子類別運算子基本x.yf(x)a[x]x++x--newtypeofcheckedunchecked->一元+-!~++x--x(T)xTrueFalse&sizeof乘法*/%加法+-變換<<>>關係和類型檢測<><=>=isas相等==!=邏輯“與”&邏輯 XOR^邏輯“或”|條件 AND&&條件 OR||條件運算?:賦值=+=-=*=/=%=&=|=^=<<=>>=??
Time of Update: 2018-12-04
我們在程式中經常會用到MessageBox。 MessageBox.Show()共有21中重載方法。現將其常見用法總結如下: 1.MessageBox.Show("Hello~~~~");最簡單的,只顯示提示資訊。 2.MessageBox.Show("There are something wrong!","ERROR"); 可以給訊息框加上標題。 3.if (MessageBox.Show("Deletethis user?", "Confirm