Time of Update: 2018-12-03
一、記憶體配置對於記憶體的分配,主要採用的是標記法。分配方法有兩種,一種是靜態分配,也就是在程式編譯的時候,就完成了對記憶體的分配。例如當一個數組在聲明時,指定長度之後,它所需要的記憶體在編譯時間就會被分配。另一種方法是動態分配,動態分配是指程式在運行時為它分配記憶體。分配記憶體的時候,對於已指派的記憶體,作業系統會給一個標記,未分配的記憶體,作業系統也會有一個標記,作業系統辨別記憶體是否可以使用就是通過標記判斷,當記憶體釋放的時候,就會修改標記。二、動態分配C函數庫關於記憶體的動態分配和釋放提
Time of Update: 2018-12-03
myclass.h#import <Foundation/Foundation.h>@interface myclass : NSObject//-(void)upatemethod:(NSString *)str;@endmyclass.m#import "myclass.h"@implementation myclass-(void)upatemethod:(NSString *)str{ NSLog(@"%@",str);}@endmain.m調用 myclass
Time of Update: 2018-12-03
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"gen-rsa1024-key-test-16" ofType:@"cmd"]; NSArray *fileData; NSError *error; //讀取file檔案並把內容根據分行符號分割後賦值給NSArray fileData = [[NSString stringWithContentsOfFile:filePath
Time of Update: 2018-12-03
Android.mk 代替 Makefile:Android編譯環境本身比較複雜,且不像普通的編譯環境:只有頂層目錄下才有Makefile檔案,而其他的每個component都使用統一標準的Android.mk.
Time of Update: 2018-12-03
map插入值 例如map<string,int>wc;string s;insert(pair)------>wc.insert(make_pair(s,1))其中insert函數是有傳回值的,返回什麼呢?返回一個pair其中這個pair中的first元素是map的迭代器,second是bool,判斷是否插入成功pair<map<string,int>::iterator,bool>
Time of Update: 2018-12-03
一:在VB中調用X控制項,添加方法 project->Add components。另外可以用Object Browser來查看控制項 二:在VC中建立X控制項1.建立一個X工程名為Clock,注意一個檔案中可以包含多個控制項。2.保持預設設定,完成。注意它產生的三個類,以及相關的介面。3.運行它。選擇TSTCON32.exe作為容器。4.選擇Insert Control,此時我們可以看到,它畫了一個橢圓。也可以在VB中測試。5.刪除註冊資訊。用regsvr32 /u
Time of Update: 2018-12-03
1.DLL簡介,動態庫,靜態庫。動態庫節約磁碟空間,靜態庫體積大。可以用多種語言編寫DLL檔案。動態庫有兩種載入方式:隱式調用和動態加裁! 2.建立一個DLL1的dll工程,加入一源檔案名稱為dll1.cpp,加入add和subtract兩個函數,注意此時須在函數名前加_declspec(dllexport),並且編譯。用dumpbi -exports
Time of Update: 2018-12-03
#include<iostream>#include<string>#include<sstream>#include<vector>using namespace std;int main(){ string s="hello my name is C++"; stringstream ss(s); string
Time of Update: 2018-12-03
vector是C++裡面很好用的容器,泛型定義的,可以動態存取任何類型,包括內建類型和複合類型,vector在<vector>標頭檔定義1vector對象的初始化,一般是按照儲存在Vector中元素的原有的預設建構函式來初始化,如string用“”初始化,int 用0初始化vector<int> a //0個元素vector<string> b //0個元素vector<int >c(20)
Time of Update: 2018-12-03
學IT的,廢話少說,直接看代碼。#include<iostream>#include<vector>#include<list>using namespace std;int main(){ int a[]={1,2,3,4,5,6,7,8,9,10}; vector<int>v(a,a+10); list<int>l(a,a+10); for(vector<int>::iterator
Time of Update: 2018-12-03
在使用包含內容的時候,對於表示類X的對象,存在著兩種主要的可選方式:1生命一個類型為X的成員2生命一個類型為X*或者X&的成員如果指標值絕不改變,那麼除了效率問題和寫建構函式,解構函式的方式之外,這些選擇方案是完全等價的:class X{ public: X(int);};class C{ X a; X *p; X &r;public: C(int i,intj,int k):a(i),p(new X(j)),r(*new X(k)){} ~C(){delete
Time of Update: 2018-12-03
我以為有一個Date的類,不像Java,C++沒有這個類,可以使用C庫time.h的函數來擷取目前時間,或者調用DOS的date方法一:#include <iostream>#include <ctime>#include<string>using namespace std;int main (){ time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo =
Time of Update: 2018-12-03
操作相對簡單,但不要以為簡單而不動手,檔案操作流在Java和C++都很重要,以下是雛形:(讓您濺笑了)檔案寫入操作#include<iostream>#include<string>#include<fstream>using namespace std;int main(){ ofstream file("c:\\hello.txt"); if(!file){ cout<<"can't open it"<<endl;
Time of Update: 2018-12-03
有了一定的Windows32編程知識,就能學習MFC了。在學習MFC之前,一定要弄明白Windows32編程中的訊息迴圈是怎麼回事。MFC實際上就是對Windows API函數的封裝。 在Windows程式設計編程中,建立一個視窗要經曆下面四個過程 (如有不懂,請看部落格
Time of Update: 2018-12-03
原來簡單解釋過屬性定義(Property) ,並且提起了簡單的retain,copy,assign的區別。那究竟是有什麼區別呢? assign就不用說了,因為基本上是為單一資料型別準備的,而不是NS對象們。 Retain vs. Copy!! copy:
Time of Update: 2018-12-03
---------------------- Windows Phone 7手機開發、.Net培訓、期待與您交流! ---------------------- 這幾天接觸到了“黑馬程式員”這一培訓班,覺得這是個機遇呀。按照流程通過的申請,下載視頻,把C#的基礎又複習了一邊,把其中比較重要的和自己容易忘記的知識點總結了下來。1.類的修飾符包括:new,public,protected,private,internal,abstract,sealed。
Time of Update: 2018-12-03
大家知道,C++中線程分兩種,一種是工作者線程,另外一種就是GUI線程,至於他們這間的區別大家可以上網上尋找這裡我只是說明一下,建立GUI線程時,需要注意的地方。有些和視窗相關的線程,最好是放在GUI線程裡,因為和視窗或是特殊控制項有關的初使化操作,GUI線程已經幫你合理的最佳化了,如果用工作者線程需要自己做這些操作,往往我們是做不好的。如果建立的MFC程式,在主視窗線程裡再建立一個子線程,用來產生一個視窗,那麼就用GUI線程,這時候,因為進程中有兩個GUI線程,新建立的視窗發送WM_CLOSE
Time of Update: 2018-12-03
下面就是excel批量上傳資料到資料庫一:UI層1.前台代碼:<a>上傳檔案(Excel):<asp:FileUpload ID="FileUpload1" runat="server" Width="237px" /></a> <a> <asp:Button ID="btnUp" runat="server" Text="匯入資料庫" Width="75px"
Time of Update: 2018-12-03
1.變數聲名C# :int x;String s;String s1, s2;Object obj;Object obj = new Object();public String name;VB文法Dim x As IntegerDim s As StringDim s1, s2 As StringDim obj 'Implicitly ObjectDim obj As New Object()Public name As String 2語句C#:Response.Write("123456"
Time of Update: 2018-12-03
C# 中實現 foreach 功能 1. MySplit 類 ////// MySplit 類 /// public class MySplit : IEnumerable { private string[] elements; public MySplit(string source, char[] delimiters) { elements = source.Split(delimiters); } IEnumerator IEnumerable.GetEnumerator() {