Time of Update: 2015-04-11
標籤:Background背景C++ is the main development language used by many of Google‘s open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, which in turn can make code more bug-
Time of Update: 2015-04-10
標籤:動態記憶體建立 二位元組 // 動態開闢一個二維數組#include <stdio.h> #include <stdlib.h> int main() { int i = 0; int j = 0; int line = 0; int row = 0; int **p = NULL; printf("輸入行數:"); scanf("%d",
Time of Update: 2015-04-10
標籤:在求最長子字串中題中要遍曆個上萬字元資料1.使用c++11代碼for (auto ch : s) {auto ss = vsi[ch];vsi[ch].insert(i);i++;}2.使用c++98代碼for (int i = 0; i < s.length(); i++) {ch = s[i];vsi[ch].insert(i);} 這兩段代碼時間比較1.c++ 112.c++
Time of Update: 2015-04-10
標籤:最近正在學習C++,對namespace的概念頗為好奇,但網上資料很零散,又不願意去翻那本厚厚的C++ Primer Plus。遂自己實驗。1. <iostream>和<iostream.h>是不一樣,前者沒有尾碼,實際上,在你的編譯器include檔案夾裡面可以看到,二者是兩個檔案,開啟檔案就會發現,裡面的代碼是不一樣的。尾碼為.h的標頭檔c++標準已經明確提出不支援了,早些的實現將標準庫功能定義在全域空間裡,聲明在帶.h尾碼的標頭檔裡,c++標準為了和C區別開,
Time of Update: 2015-04-10
標籤:c++ 素數 最佳化篩選法 孿生素數(間隔為2的相鄰素數)的相關定理與推論P1: 當 N 不小於 6 且 N-1 和 N+1 為 孿生素數, 則 N 一定是 6的倍數T1:當 N 不小於 1 且 N=6x-1 或 N=6x+1 不是素數, 那麼 N 一定不是 2和 3的倍數P2:當N 不小於 5 時,若 N 為素數,那麼N mod 6 =1或N mod 6 = 5T2:
Time of Update: 2015-04-10
標籤:原理:異或運算加密:#include<stdio.h>#include<stdlib.h>#include<string.h>#define KEY ‘@‘int main(int argc, char * argv[]){ FILE *fp; FILE *coded; char codedname[40]; char ch; if(argc < 2){ printf("param error!\n");
Time of Update: 2015-04-10
標籤:Re:題意:有無限多的電燈排成一列,一開始都是關,操作無限多次,第i次操作會把編號為i和i的倍數的電燈改變狀態。問最後第i盞電燈的狀態是開還是關 //後邊有資料。。。#include<stdio.h>int main(){ int b,n,i; while(scanf("%d",&n)!=EOF) { if(n==1)//第一次操作,開關全變為1; printf("1\n"); else {
Time of Update: 2015-04-08
標籤:http://blog.csdn.net/roger_77/article/details/1538447/C/C++中判斷某一檔案或目錄是否存在 1.C++很簡單的一種辦法:#include <iostream>#include <fstream>using namespace std;#define FILENAME "stat.dat"int main(){
Time of Update: 2015-04-09
標籤:c語言 通訊錄 同一檔案 結構體 數組 //【C語言】通訊錄(一個檔案實現)#include <stdio.h>#include <string.h>#define NAME_MAX 20#define SEX_MAX 5#define TEL_MAX 11#define ADDR_MAX
Time of Update: 2015-04-06
標籤:c++ metaprogramming c++11 boost 2 用於判斷類型的traits類is_void類可以判斷模板參數的類型,使用很簡單,注意,也可以直接使用::value。cout << std::is_void<void>::type::value << endl;cout <<
Time of Update: 2015-04-07
標籤:1、debug版int main(){011752E0 push ebp 011752E1 mov ebp,esp 011752E3 sub esp,0C0h 011752E9 push ebx 011752EA push esi 011752EB push edi 011752EC lea edi,[ebp-0C0h] 011752F2 mov
Time of Update: 2015-04-03
標籤:標準方法是用: EnumPrinters() 函數擷取#define PRINTER_ENUM_DEFAULT 0x00000001#define PRINTER_ENUM_LOCAL 0x00000002#define PRINTER_ENUM_CONNECTIONS 0x00000004#define PRINTER_ENUM_FAVORITE 0x00000004#define PRINTER_ENUM_NAME
Time of Update: 2015-04-04
標籤:cpp__declspec(noinline)int__tmainCRTStartup( void ){ int initret; int mainret=0; int managedapp;#ifdef _WINMAIN_ _TUCHAR *lpszCommandLine; STARTUPINFOW StartupInfo; GetStartupInfoW(
Time of Update: 2015-04-03
標籤:const_cast reinterpret_cast static_cast dynamic_cast 強制轉換 做個筆記:源自論壇:http://bbs.csdn.net/topics/210039564總結C++中的所有強制轉換函式(const_cast,reinterpret_cast,static
Time of Update: 2015-04-03
標籤:#include <iostream>#include <string>using namespace std;class Animal{public: Animal(); Animal(string name); string mouth; void eat(); void sleep(); void drool(); string name;};class Pig : public Animal{public:
Time of Update: 2015-04-09
標籤:需求:在不定時間段運行多個背景程式(winfrom,wpf,console,等等)用於更新資料。 問題:為什麼要使用計劃任務,而不直接在程式中使用一個計時器來出發呢?答:最明顯的一點,使用計時器程式一直在後台運行著,但需求中只需要一天運行一次,或一個月運行一次。一直後台跑著計時這不白浪費CPU資源麼。 解決方案:1.使用windows內建的計劃任務
Time of Update: 2015-04-05
標籤:.net framework 搜尋 遍曆 c# arraylist
Time of Update: 2015-04-03
標籤:本文轉載自:http://blog.csdn.net/educast/article/details/2894892兩個現實中的例子:1、B超:大家體檢的時候大概都做過B超吧,B超可以透過肚皮探測到你內髒的生理情況。這是如何做到的呢?B超是B型超聲波,它可以透過肚皮通過向你體內發射B型超聲波,當超聲波遇到內髒壁的時候就會產生一定的“迴音”反射,然後把“迴音”進行處理就可以顯示出內髒的情況了(我不是醫生也不是聲學專家,不知說得是否準確^_^)。
Time of Update: 2015-04-06
標籤:acm c++ 杭電 演算法 編程 A CTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4206 &
Time of Update: 2015-04-03
標籤:參考 http://9200cs.blog.163.com/blog/static/134577369201041111656659/ 環境:VS2008 一、建立一個dll程式add,程式非常簡單,其功能就是實現簡單的a+b。1、建立一個項目名為add選擇dll 然後開啟dllmain.cpp,代碼:// dllmain.cpp : 定義 DLL 應用程式的進入點。#include "stdafx.h"int WINAPI add(int a, int b)