Time of Update: 2018-12-03
一.環境: x86/WinXP/VC 6.0二.用例:int swap(int a, int b){ int v; v = a; a = b; b = v; return v;}void main(void){ int a = 7; int b = 10; int c = 0; c = swap(a,b); return;}三.分析:1: int swap(int a, int b)2: {00401020 push ebp00401021 mov
Time of Update: 2018-12-03
#include <stdlib.h>把字串轉化成浮點數:double atof( const char *str ); 或 double strtod( const char *start, char **end );把字串轉化成整型數:int atoi( const char *str ); 長整型:long atol( const char *str );二分尋找:void *bsearch(const void
Time of Update: 2018-12-03
/**函數原型:#include <stdlib.h>void qsort( void *buf, size_t num, size_t size, int (*compare)(const void *, const void *) );**/// For example:int compare( const void* a, const void* b ){ int* arg1 = (int*)a; int* arg2 = (int*)b; if ( *arg1
Time of Update: 2018-12-03
服務端:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using
Time of Update: 2018-12-03
#include <stdio.h>#include <time.h>void main(){time_t sec; //typedef long time_tstruct tm * curTime;sec = time(NULL); //擷取時間,從1970.1.1到現在的秒數,也可以寫成 time(&sec);curTime = localtime(&sec);
Time of Update: 2018-12-03
1.駐留機制從老師給的資料 http://www.cnblogs.com/solan/archive/2012/08/03/CSharp07.html大概瞭解了C#底層對字串的處理。字串操作是最基本的操作之一,隨便給一篇文章,裡面的字串就有很多,處理這樣大量的資料,無論是空間還是時間我們都應該最佳化,在C#中,實現這個功能的就是駐留機制。駐留機制顧名思義,就是字串常駐在某個地方,這個地方就是記憶體空間。我們在建立一個string的對象的時候,正常的話對於每一個string對象都申請一個空間存放這
Time of Update: 2018-12-03
一個完全的Pascal程式結構program 程式名; uses 已知單元說明; label 標號說明; const 常量說明; type 類型說明; var 變數說明; function 函數說明; procedure 過程說明;begin 語句; 語句; …… 語句end.1. 注釋不同一般有三種注釋的方法:{this is a comment}(* this is another comment *)// this is a comment up to the end of
Time of Update: 2018-12-03
/*zstu 2021*//*這是解a*x+b*y=1的演算法,如果要求a*x+b*y=n,只要結果乘以n就可以了*、#include<stdio.h>int gcd(int a,int b,int*x,int *y){int temp,r;if(a%b==0){*x=0;*y=1;return b;}r=gcd(b,a%b,x,y);temp=*x;*x=*y;*y=temp-a/b*(*y);return r;}
Time of Update: 2018-12-03
#include <stdio.h>#define LL unsigned long long intinline LL mod(LL a,LL b){while (a>=b)a-=b;return a;}//a*b mod cinline LL MulAndMod(LL a, LL shl_b,LL c){LL val,pre;pre = mod(a,c);val = 0;while (shl_b){if (shl_b&0x1)val = mod(val + pre,
Time of Update: 2018-12-03
http://www.codeforces.com/problemset/problem/212/C不錯的一個DP題,重在思維。(YY了大神的代碼良久)題意:給你一串由A 和 B組成的字串,首尾是相連的,組成一個環有個規則就是AB 會 變成BA,然後問你有多少個串可以一步變成給你的串比如
Time of Update: 2018-12-03
妥妥的滾組了。。。A題:很久沒做CF導致想了一個比較煩的方法,還sb的WA一次。。B題:可以發現答案是2^p *
Time of Update: 2018-12-03
提交地址:http://codeforces.com/gym/100110 B題http://hi.baidu.com/aekdycoin/item/e051d6616ce60294c5d249d7幾個測試資料1515151 1213...0836060000151144 2002...355873344010000000000 11411...0000000000115123131 1210...212639300054546161515130 121231321...6496000000
Time of Update: 2018-12-03
這是對C++高效編程的一個總結, 很有指導作用.一、#include “filename.h”和#include <filename.h>的區別#include “filename.h”是指編譯器將從當前工作目錄上開始尋找此檔案#include <filename.h>是指編譯器將從標準庫目錄中開始尋找此檔案二、標頭檔的作用加強安全檢測通過標頭檔可能方便地調用庫功能,而不必關心其實現方式三、* , &修飾符的位置int *i,j; // better for
Time of Update: 2018-12-03
Using Unsafe Code in C#Using Unsafe Code – Part 1C# .NET hides most of memory management, which makes it much easier for the developer. Thanks for the Garbage Collector and the use of references. But to make the language powerful enough in some
Time of Update: 2018-12-03
前兩天寫個程式,引用的dll首次啟動並執行時候,需要手動註冊(貌似是個activex dll)。於是想個辦法,用C++程式實現。註冊要在dos視窗中,那麼是不是要在程式中用shellexcute執行命令列(使用方法見我的博文)。看了很多資料,發現,shellexcute只能執行一個命令(開啟檔案,運行某個應用程式等)。接著就找到寫bat檔案的方法:@echo offregsvr32.exe E:\VC.dllpause路徑是絕對路徑,那麼如何獲得的呢?找到目錄有三種方法:char *p;
Time of Update: 2018-12-03
以前討論過在一張圖片上加上另一張圖片,說難也不難,基本上只要知道利用GDI+提供的DrawImage函數就可以了。現在需要在圖片上打上文字,其實也很簡單。貼圖用DrawImage,那麼貼文字當然就是DrawString啦。 //============================設定文字============================== /**//// <summary> /// 設定文字 /// </sum
Time of Update: 2018-12-03
#include<stdio.h>main(){ int a[16][16],i,j,k,p,m,n; p=1; while(p==1) { printf("Please input n(1<n<15 ,n is single) /n"); scanf("%d",&n); if((n!=0)&&(n<=15)&&(n%
Time of Update: 2018-12-03
當我們需要只有一個類的執行個體返回給調用程式時,就可以使用單件設計模式(Singletom pattern).這種類的聲明如下:class TheOnlyInstance{public: static TheOnlyInstance * GetTheOnlyInstance();protected: TheOnlyInstance(){}private: //} ; //只能通過公有靜態方法來訪問TheOnlyInstance*
Time of Update: 2018-12-03
在使用 C 語言時,您是否對花時間調試指標和記憶體流失問題感到厭倦?如果是這樣,那麼本文就適合您。您將瞭解可能導致記憶體破壞的指標操作類型,您還將研究一些情境,瞭解要在使用動態記憶體分配時考慮什麼問題。引言對於任何使用 C 語言的人,如果問他們 C 語言的最大煩惱是什麼,其中許多人可能會回答說是指標和記憶體流失。這些的確是消耗了開發人員大多數調試時間的事項。指標和記憶體流失對某些開發人員來說似乎令人畏懼,但是一旦您瞭解了指標及其關聯記憶體操作的基礎,它們就是您在 C
Time of Update: 2018-12-03
C 風格(C-style)強制轉型如下:(T) exdivssion // cast exdivssion to be of type T函數風格(Function-style)強制轉型使用這樣的文法:T(exdivssion) // cast exdivssion to be of type