Time of Update: 2018-12-03
參考酷客網,對其進行了簡單整理1、下面的程式並不見得會輸出 hello-std-out,你知道為什麼嗎?#include<stdio.h>#include<unistd.h>intmain() { while(1) { fprintf(stdout,"hello-std-out"); fprintf(stderr,"hello-std-err"); sleep(1); } return
Time of Update: 2018-12-03
5.2 在Tornado下的C++開發基本的C++支援被捆綁在Tornado開發環境裡。VxWorks提供了包含對所有程式的C++安全聲明的標頭檔和必須的run-time support.標準的Tornado互動式開發工具如調試器(debugger),shell,和新增的載入器(loader)都包含了對C++的支援。 5.2.1 工具支援WindShTornado支援C和C++開發語言.WindSh能夠解釋簡單的C++運算式。為了練習在C運算式解釋程式(C-expression
Time of Update: 2018-12-03
C# 繪圖--飄帶 //-------------------------------------// DrawStreamer.cs by Flycrane//------------------------------------- using System; using System.Drawing; using System.Windows.Forms; class DrawStreamer : Form { public static void
Time of Update: 2018-12-03
開始陸續的發一下唐老師視頻的筆記吧,順便帶一些正沖哥書的的內容。不能一下都發出來,因為內容發多了自己也受不了,而且發的都是學習視頻時候的一些筆記,可能會有一些問題不是很清晰。先說一下C語言中的記憶體管理。1.動態記憶體分配①原因:程式運行過程中,很有可能需要一些額外的記憶體空間。②動態記憶體從哪裡來,還給誰? 這塊是記憶體是系統專門預留出來的,給程式動態分配和動態歸還的。 當free函數的參數為空白的時候,那麼我們的free什麼事都不做了。
Time of Update: 2018-12-03
extern “C”在C++環境下使用C函數的時候,常常會出現編譯器無法找到obj模組中的C函數定義,從而導致連結失敗的情況,應該如何解決這種情況呢?答案與分析:C++語言在編譯的時候為瞭解決函數的多態問題,會將函數名和參數聯合起來產生一個中間的函數名稱,而C語言則不會,因此會造成連結時找不到對應函數的情況,此時C函數就需要用extern “C”進行連結指定,這告訴編譯器,請保持我的名稱,不要給我產生用於連結的中間函數名。testC.h#ifndef __testC#define
Time of Update: 2018-12-03
/*** ROSE attack (variation 2) (chuck (at) lemure.net) Discovered by: gandalf (at) digital.net code modified from large IGMP attack by: Kox by Coolio (coolio (at) k-r4d.com) Sends out small IP fragments totalling up to
Time of Update: 2018-12-03
枚舉的定義包括關鍵字 enum,後面是一個可選的枚舉類型名,和一對花括弧,花括弧裡面的是枚舉成員。1預設地,第一個枚舉成員賦值為0,後面的枚舉成員比前面的大1,如enum open{input,output,append};此時open=0;output=1;append=2;enum open{input1=3,output1,append1};此時input1=3,output1=4,append1=5; 2枚舉成員是常量,可以用與計算:如用上面的例子int result=append1*2
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<vector>using namespace std;int main(){ int a[]={1,2,3,4,5,6,7,8,9,10}; vector<int>v(a,a+10); fill(v.begin(),v.end(),20); for(vector<int>::iterator iter=v.begin();iter!=v.end();++iter){ cout<<*
Time of Update: 2018-12-03
有了一定的Windows32編程知識,就能學習MFC了。在學習MFC之前,一定要弄明白Windows32編程中的訊息迴圈是怎麼回事。MFC實際上就是對Windows API函數的封裝。 在Windows程式設計編程中,建立一個視窗要經曆下面四個過程 (如有不懂,請看部落格
Time of Update: 2018-12-03
#include<iostream>#include<string>#include<vector>using namespace std;class Person{public: Person(string name1,int age){ //name=new string; this->name=name1; this->age=age; } virtual void show(){ cout<<name<<"
Time of Update: 2018-12-03
C++ string類中的字串尋找 類string提供了大量尋找功能和搜尋功能,其中比較常用的尋找和搜尋函數是find()函數、find_first_not_of()函數、find_first_of()函數、find_last_not_of()函數、find_last_of()函數、rfind()等。 find()函數的文法如下所示: (1) size_type find(E c, size_type pos = npos)
Time of Update: 2018-12-03
條款03: 儘可能使用const本條款總結了const的使用情境和使用它帶來的好處。關鍵字const多才多藝。char greeting[]="hello":char *p=greeting;//non-const pointer,non-const dataconst char* p=greeting;//non-const pointer,const datachar* const p=greeting;//const pointer,non-const dataconst char*
Time of Update: 2018-12-03
itoa 功 能:把一整數轉換為字串 用 法:char *itoa(int value, char *string, int radix); 詳細解釋:itoa是英文integer to array(將int整型數轉化為一個字串,並將值儲存在數組string中)的縮寫. 參數: value: 待轉化的整數。 radix: 是基數的意思,即先將value轉化為radix進位的數,範圍介於2-36,比如10表示10進位,16表示16進位。 * string: 儲存轉換後得到的字串。
Time of Update: 2018-12-03
#include <stdlib.h>#include <stdio.h> // for printf getchar/*VS平台不提供以下兩個h檔案#include <syslib.h>#include <alloc.h>*/int main(){ char *p; system("cls"); // clear screen TC環境中可使用clrscr();而VS平台不提供此介面//malloc
Time of Update: 2018-12-03
1、C語言中單鏈表的實現typedef struct node /*節點的定義*/ { Item item; /*資料域*/ node *next; /*鏈域*/}Node,*PNode;Node dt; typedef PNode List;我們將單鏈表和int a = 3;作類比,其中Node(別名)相當於int指代資料類型,dt相當於a指代變數名(注意dt非指標,僅僅只是一個變數,因此我們定義了*PNode別名作為指標)。而PNode則為指標資料類型,指向結構體
Time of Update: 2018-12-03
checked和unchecked操作符用於整型算術運算時控制當前環境中的溢出檢查。下列運算參與了checked和unchecked檢查(運算元均為整數):1) 預定義的++和――一元運算子。2) 預定義的-一元運算子。3) 預定義的+、-、×、/等二元操作符。4) 從一種整型到另一種整型的顯示資料轉換。當上述整型運算產生一個目標類型無法表示的大數時,可以有相應的處理方式:(一)使用checked若運算是常量運算式,則產生編譯錯誤:The operation overflows at
Time of Update: 2018-12-03
using System;using System.Collections.Generic;using System.Text;//使用者自訂轉換 //所有的使用者自訂轉換都是靜態,要使用static關鍵字 //使用者自訂轉換分顯示和隱示,它們用implicit(隱式轉換)或 explicit(顯示轉換)關鍵字聲明。 //static 訪問修辭符 轉換修辭符 operator 轉換類型(參數) namespace CountStrDemo{ class 自訂類型轉換 {
Time of Update: 2018-12-03
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading ;namespace 多線程{ class 線程池 { public static void Main() { int workNums ; int ioNums ;
Time of Update: 2018-12-03
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;namespace 多線程{ class 非同步回調 { public delegate int TakesAwhileDel(int data, int ms); static void Main(string[] args) {