Time of Update: 2015-05-06
標籤:轉!http://blog.sina.com.cn/s/blog_5155e8d401009145.html qsort,包含在stdlib.h標頭檔裡,函數一共四個參數,沒傳回值.一個典型的qsort的寫法如下qsort(s,n,sizeof(s[0]),cmp);其中第一個參數是參與排序的數組名(或者也可以理解成開始排序的地址,因為可以寫&s[i]這樣的運算式,這個問題下面有說明); 第二個參數是參與排序的元素個數; 第三個三數是單個元素的大小,推薦使用sizeof(
Time of Update: 2015-05-06
標籤:前六章的知識架構概念(細枝末節的糾纏)細節點的分析(坑逼)實際的代碼演練?Chapter1基礎知識 進位 儲存Chapter2 簡單程式 資料類型 運算子和運算式 資料類型轉化 I/OChapter3 控制結構 (迴圈嵌套是什麼鬼)Chapter4 函數Chapter5 數組(二維數組是什麼鬼 然而完全不會)Chapter6 自訂資料類型(然而只會結構體)? (臥槽這是什麼鬼啊,別人 數學邏輯不錯然而好東西我看不懂啊)(以後做作業解決問題也要好好寫隨筆 !)TAGS:進位?
Time of Update: 2015-05-06
標籤:遍曆目錄 判斷目錄 c++檔案操作 1. 思路 使用FindFirstFile、FindNextFile函數,來遍曆目錄。結果儲存在WIN32_FIND_DATA結構體中。將查詢結果的dwFileAttributes和FILE_ATTRIBUTE_DIRECTORY取與操作,判斷是否為目錄。2. 範例程式碼#include <iostream>#include
Time of Update: 2015-05-06
標籤:c++ primer第四版//讀一組數到vector對象,計算收尾配對元素的和並輸出#include <iostream>#include <vector>int main(){ std::vector<int> ivec; int temp, add; while(std::cin>>temp) ivec.push_back(temp); typedef std::vector<int>::
Time of Update: 2015-05-06
標籤://輸入一個矩陣,按照從外向裡以順時針的順序依次列印出每一個數字,//例如,如果輸入如下矩陣: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 //則依次列印出數字1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10. #include <iostream>using namespace std;void Grial(int (*a)[5],int n){int a1 = 0;int b1 = n-1;bool
Time of Update: 2015-05-06
標籤:摘自:http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_inheritance_continued.html這個系列的第一部分介紹了"封裝",第二部分介紹了使用建構函式實現"繼承"。今天是最後一個部分,介紹不使用建構函式實現"繼承"。一、什麼是"非建構函式"的繼承?比如,現在有一個對象,叫做"中國人"。 var Chinese =
Time of Update: 2015-05-06
標籤:#include "stdafx.h"#include <algorithm>#include <functional>#include <vector>#include <iterator> using namespace std;int _tmain(int argc, _TCHAR* argv[]){ &nb
Time of Update: 2015-05-05
標籤:1.typedeftypedef用來定義同類型的同義字。如:1 typedef unsingned int size_t;2 typedef int ptrdiff_t;3 typedef T * iterator;需要注意的是,不應該將typedef當做文本擴充來看待,如下例:1 typedef string * pstring;2 const pstrng cstr;此時第二行中cstr應該表示什麼類型呢?若當做文本擴充,則會認為cstr表示const string
Time of Update: 2015-05-06
標籤:#include<stdio.h>class Bclass;class Aclass{public: friend Bclass; void func() { pB->funcB(); } int data; Bclass* pB;};class Bclass{public: friend Aclass; void funcB() { p->func(); }
Time of Update: 2015-05-05
標籤:c++ stl set algorithm 集合 set也是STL中比較常見的容器。set集合容器實現了紅/黑樹狀結構的平衡二叉檢索樹的資料結構,它會自動調整二叉樹的排列,把元素放到適當的位置。set容器所包含的元素的值是唯一的,集合中的元素按一定的順序排列。我們構造set集合的目的是為了快速的檢索,不可直接
Time of Update: 2015-05-06
標籤:c++ primer第四版#include <iostream>#include <string>#include <cctype>int main(){ std::string str, result_str; bool flag=false; while(getline(std::cin, str)) { for(unsigned index=0; index<str.size(); ++index)
Time of Update: 2015-05-06
標籤: 最近看到園子裡有人用python做的爬蟲軟體並且上傳的源碼,苦於不懂python,便想著用C#也實現一個簡易的爬蟲軟體。於是昨晚花了一個多小時的時間實現了一個簡單的爬蟲軟體,功能十分簡單,但是覺得還是想分享出來。。。後續樓主還會把功能繼續完善下去。。 廢話不多說,直接上碼! 其實代碼很簡單: public string CreateWeb(string url)
Time of Update: 2015-05-06
標籤:using System;using System.IO;namespace ConsoleApplication2{ class Program { private const string FILE_NAME = "Test.txt"; static void Main(string[] args) { //Console.WriteLine( File.Exists(@"C:\Hello\IO.txt"));
Time of Update: 2015-05-06
標籤:Random類建構函式1) Random random = new Random(); // 無參數建構函式使用系統時鐘產生其種子值然而,系統時鐘取值範圍有限,因此在小規模計算中,可能無法使用不同的種子值分別調用此建構函式, 這將導致兩個random對象產生相同的隨機數字序列。 1 using System; 2 using System.Collections.Generic; 3 4 namespace FirstTest 5 { 6 class Program 7
Time of Update: 2015-05-06
標籤:c#using System;using System.Windows.Forms;public class frmMain : Form{ #region Windows Code private void InitializeComponent()
Time of Update: 2015-05-06
標籤:https://msdn.microsoft.com/zh-cn/library/bcd5672a.aspx官方的說法The protected keyword is a member access modifier. A protected member is accessible within its class and by derived class
Time of Update: 2015-05-06
標籤:對於一些大型的項目,通常由很多個DLL檔案組成,引用了這些DLL,就能訪問DLL裡面的類和類裡面的方法。比如,你寫了一個記錄日誌的DLL,任何項目只要引用此DLL就能實現記錄日誌的功能,這個DLL檔案的程式就是一個程式集。如果你記錄日誌的程式集是這麼定義的:namespace LogerHelper { internal class aa { public void bb() { return ""; }
Time of Update: 2015-05-06
標籤:
Time of Update: 2015-05-06
標籤:1.在globals.h 中定義一個函數ReplaceStr,實現字串的替換:int ReplaceStr(char* sSrc, char* sMatchStr, char* sReplaceStr){ int StringLen; char caNewString[1024]; char* findPos; merc_timer_handle_t timer_ReplaceStr = lr_start_timer();
Time of Update: 2015-05-06
標籤: 前言 標準C提供的檔案相關的IO函數,除標準錯誤輸出是不帶緩衝的(可以儘快的將錯誤訊息顯示出來)之外,所有與終端相關的都是行緩衝,其餘都是全緩衝的。 我們可以使用setbuf,setvbuf改變指定流的緩衝類型。 原型: void setbuf(FILE *stream, char *buf);int setvbuf(FILE *stream, char *buf, int mode, size_t size);