Time of Update: 2018-12-07
原文:http://www.cppblog.com/xiaozhuozhuo/archive/2007/07/23/28663.html▲1、C語言標準庫函數atoi()等。函數名: atoi 功 能: 把字串轉換成整型數 用 法: int atoi(const char *nptr); 程式例: #include <stdlib.h> int main(void) { int n; char *str = "435"; n = atoi(str); printf("string =
Time of Update: 2018-12-07
比較: public static extern int comp2(byte[] a, byte[] b, int count); [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl, SetLastError = false)] static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);
Time of Update: 2018-12-07
學習編譯技術,老師出了個題目:給我們一份簡單的pascal代碼,讓我們用C語言識別代碼中的單詞,並分析出單詞的類別,沒學過C,我直接用C++寫了一份!用C++寫代碼的時候,感覺沒用到什麼編譯技術裡的知識,鬱悶!老師出的是什麼題目啊!貼一下代碼,希望給感興趣的剛入門的朋友一些小小的協助!pascal代碼:Begin f:=1; lastf:=0; n:=0; For I:=1 To 20 Do Begin if(n mod 4 = 0) THEN WRITELN;
Time of Update: 2018-12-07
計算類的的大小時只考慮成員變數的大小,而不考慮成員函數的大小!但是如果類中含有虛函數,那麼在計算類的大小時就要額外的加上4個位元組!這4個位元組是虛函數表占的位元組數!在計算類的大小時還要注意一點就是 記憶體對齊!看一個例子:class CTest{ char ch;}; // sizeof(CTest) = 1 class CTest{ char ch; int num;}; //
Time of Update: 2018-12-07
最近在公司實習,每次上班都要打卡,初來乍到,老是忘了!無奈寫了一個定時上公司OA打卡的程式!寫的過程中發現公司OA系統(網站)上的按鈕(圖片、超連結)很難Find,分析了一下網頁源碼,發現公司OA系統全是用Frame布局的,為了能精準定位,我用遞迴遍曆了一下OA系統的所有框,把每個架構裡的Html代碼都挖掘出來!以便定位自己要擷取的元素! // webBrowser先設定Url,然後填充資料(賬戶和密碼)實現自動登入OA,等網站載入完畢之後開始分析架構 //
Time of Update: 2018-12-07
引言前段時間為客戶開發一套印表機配套的軟體,對C#中調用印表機做了些研究。問題.Net Framework
Time of Update: 2018-12-07
今天整理演算法的時候發現在過去在c++中用UINT指標訪問32位ARGB位元影像時,每次位移量正好一個象素,所以直接使用“++”而不是“+= 4”。同理,當直接用座標訪問時,應使用“i * stride / 4 + j” 而不是“i * stride +
Time of Update: 2018-12-07
建構函式 如果一個類不包含建構函式,那麼編譯器將建立一個名為“預設建構函式”的隱含方法,預設建構函式包含一個空白的參數列表。使用建構函式的注意事項 類的建構函式名要與類名相同 建構函式沒有傳回型別 一般情況下,建構函式是public類型的 不能顯式調用建構函式解構函式~類名(){statement}解構函式的注意事項 解構函式沒有參數 解構函式沒有傳回值 解構函式沒有修飾符 解構函式不能被重載 解構函式不能被顯式調用
Time of Update: 2018-12-07
一、關於數組對象和vector對象Account *pact = new Account[10]1.在堆中分配包含10個Account類對象的數組;2.用Account類預設建構函式初始化釋放*pact不要用delete pact只是第一個類對象上調用了解構函式;應該使用delete [] pact;vector<Point> vec(5);//I初始化過程
Time of Update: 2018-12-07
Exception 類 描述
Time of Update: 2018-12-07
#include <iostream>#include <limits>#include <stdlib.h>using namespace std;typedef unsigned __int64 UINT64; typedef __int64 INT64; int main(){int intMax = numeric_limits<int>::max();int intMin =
Time of Update: 2018-12-07
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Threading;using System.Diagnostics;namespace _{ public partial class Form1 :
Time of Update: 2018-12-07
#include <iostream>using namespace std;int multi(const int a[], const int b[], int c[], const int len){ for (int k=0; k<2*len-1; k++) { for (int i=0; (i<k+1)&&(i<len); i++) { if (k-i<len) { int temp=a[i]*b[k-i];
Time of Update: 2018-12-07
聲明數組時,要在各個元素的變數類型後面,加上一組方括弧.int[] Intergers;要初始化特定大小的數組,可以使用new關鍵字,在類型後面的方括弧中給出大小int[] Integers = new int[2]也可以聲明時不初始化,以後動態指定大小.int[] Integers;Integers = new int[32];在初始化數組時,不能用變數設定數組應包含多少元素.但是可以給數組長度聲明一個常量:const int len=3;string[] Strings = new
Time of Update: 2018-12-07
NET Framework 為非同步作業提供了兩種設計模式:使用 IAsyncResult 對象的非同步作業與使用事件的非同步作業。概述IAsyncResult 非同步設計模式通過名為 BeginOperationName 和 EndOperationName 的兩個方法來實現原同步方法的非同步呼叫,如 FileStream 類提供了 BeginRead 和 EndRead 方法來從檔案非同步讀取位元組,它們是 Read 方法的非同步版本 Begin 方法包含同步方法簽名中的任何參數,此外還包
Time of Update: 2018-12-07
網上並沒有太多完整的代碼,只是對單字進行解碼,或連續編碼的解碼,但如果中間插有字元或數字,就掛了 貼一小段代碼,可以解決了,原理其實就是以4個字元中一組,進行解碼 private String DecodeUnicode(String dataStr) { Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})"); return reg.Replace(dataStr, dele
Time of Update: 2018-12-07
stringstr1 =string.Format("{0:N1}",56789); //result: 56,789.0stringstr2 =string.Format("{0:N2}",56789); //result: 56,789.00stringstr3 =string.Format("{0:N3}",56789); //result: 56,789.000stringstr8
Time of Update: 2018-12-07
已知有一個XML檔案(bookstore.xml)如下:<?xml version="1.0" encoding="gb2312"?><bookstore><book genre="fantasy" ISBN="2-3631-4"><title>Oberon's Legacy</title><author>Corets,
Time of Update: 2018-12-07
[Serializable] public class SolidButton : Button, ISerializable { public SolidButton(SerializationInfo info, StreamingContext ctxt) { this.Location = new Point((int)info.GetValue("X", typeof(int)),
Time of Update: 2018-12-07
Hashtable和ArrayList等經常需要深度拷貝,而.Net沒有現成的函數可以調用,public object Clone() { BinaryFormatter Formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone)); MemoryStream stream = new MemoryStream();