Time of Update: 2015-07-04
標籤:#include <bits/stdc++.h>using namespace std;const int MAX = 1e5+10;vector<int> filter(const vector<int> &vec,int val,less<int> <) {  
Time of Update: 2015-07-04
標籤: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using mshtml;using System.Collections;using
Time of Update: 2015-07-04
標籤:c++11 class linux 多態 x86 C++是一種物件導向的進階語言,但是由於其基於C語言發展而來,因此其內在原理和C語言如出一轍,於是就來看看C++程式翻譯成彙編代碼是啥樣的(在x86 linux環境下,使用g++ 翻譯得到的結果),採用了C++
Time of Update: 2015-07-04
標籤:轉載:http://blog.chinaunix.net/uid-2413049-id-109836.html在閱讀wget原始碼的過程中,發現一個用C語言實現,獲得堆棧增長方向的巧妙方法wget版本為1.11.4實現代碼:static voidfind_stack_direction (){ static char *addr = NULL; /* Address of first `dummy‘, once
Time of Update: 2015-07-04
標籤:一、開發工具的選擇(1)可以用來寫代碼的工具:記事本、UltraEdit、Vim、Xcode等(2)選擇Xcode的原因:蘋果官方提供的開發利器、簡化開發過程、有高亮顯示功能
Time of Update: 2015-07-04
標籤:1.聲明聲明整形數組 組合語言 c語言 大小範圍(從一個位元組到8個位元組) .section dataarr_int8: .byte 1,2,3,4,5 int8_t arr_int8[] = {1,2,3,4,5}; 聲明數組元素是1個位元組的數組 .section dataarr_int16: &
Time of Update: 2015-07-04
標籤:裝飾模式 decorator 大話設計模式 c++
Time of Update: 2015-07-04
標籤:// 類比庫函數strstr#include <stdio.h>#include <assert.h>const char* my_strstr(const char *parent, const char *child){const char *pgo = parent;const char *cgo = child;const char *pgos = parent;assert(parent != NULL && child != NULL)
Time of Update: 2015-07-04
標籤:一 待用資料成員:1.待用資料成員的定義。 待用資料成員實際上是類域中的全域變數。所以,待用資料成員的定義(初始化)不應該被放在標頭檔中,因為這樣做會引起重複定義這樣的錯誤。即使加上#ifndef #define #endif或者#pragma once也不行。 其定義方式與全域變數相同。舉例如下: xxx.h檔案 class base{ private: static const int _i;//聲明,標準c++支援有序類型在類體中初始化,但vc6不支援。
Time of Update: 2015-07-04
標籤:1、宏定義函數:例:#define do{exp} while(0)與#define exp有什麼不同,好處在哪裡?定義複雜代碼,防止分號,或是括弧不匹配等錯誤。比如:定義:#define switch(x,y) {int tmp; tmp="x";x=y;y=tmp;}使用時: if(x>y) switch(x,y);else //error,
Time of Update: 2015-07-04
標籤://字串替換空格:實現一個函數,把字串裡的空格替換成“%20”#include <stdio.h>#include <assert.h>void replace(char *src){assert(src);int OldLen = 0; //原字串長度int NewLen = 0; //新字串長度int BlackNum = 0; //空格數量int NewBack
Time of Update: 2015-07-04
標籤://判斷一個字串是否是一個字串的旋轉字串//利用庫函數實現#include <stdio.h>#include <string.h>#include <assert.h>int IsRotate(char *str1, const char *str2){assert(str1);assert(str2);strncat(str1, str1,strlen(str1));if (NULL == strstr(str1, str2))return
Time of Update: 2015-07-04
標籤://類比實現庫函數strstr,尋找子字串#include <stdio.h>#include <assert.h>char * my_strstr( char *dst, const char * src){assert(dst);assert(src);int i, j, k;for (i = 0; dst[i] != '\0'; i++){for (j = i, k = 0; src[k] !=
Time of Update: 2015-07-04
標籤://編寫函數實現字串旋轉#include <stdio.h>#include <assert.h>#include <string.h>void reverse(char *left, char *right) {char temp;assert(left);assert(right);while (right > left){temp = *left;*left = *right;*right = temp;left++;right--;}
Time of Update: 2015-07-04
標籤://編寫函數實現庫函數atoi,把字串轉換成整形#include <stdio.h>#include <string.h>int my_atoi(const char *src){int flag=1;int sum=0;while (*src){if (*src == ' ')src++;else if (*src == '+'){src++;flag = 1;}else if(*src == '-'){src++;
Time of Update: 2015-07-04
標籤:1.html代碼:<asp:FileUpload runat="server" ID="UpLoadFile"/> <asp:Button runat="server" ID="btnUpLoad" OnClick="btnUpLoad_Click" Text="上傳"/>html代碼2.後台代碼:public partial class UpLoadFilesByStream : System.Web.UI.Page {
Time of Update: 2015-07-04
標籤: int? 是可為null的實值型別。只比int多一個值就是null。 思考: 同樣的記憶體空間,怎麼實現的多一個值的?都是4位元組,32位,int?靠什麼存在一個null值的。 發現: 分析一下記憶體,看看如何?。 當int i = max; int? j = max; 發現j的下一個4位元組地址的值和i一樣。 給j賦值null,原來的1變為0. 給j賦值0,原來的0變為1. j賦值1,還是1.
Time of Update: 2015-07-04
標籤:1.html代碼:<body> <form id="form1" runat="server"> <div> <asp:FileUpload runat="server" ID="UpLoadFile"/> <asp:Button runat="server" ID="btnUpLoad" OnClick="btnUpLoad_Click" Text="上傳"/> </div&
Time of Update: 2015-07-04
標籤:1 什麼是c#C#,讀做 "C sharp",是微軟公司發布的一種物件導向的、運行於.NET Framework之上的進階程式設計語言。C#綜合了VB簡單的可視化操作和C++的高運行效率,以其強大的操作能力、優雅的文法風格、創新的語言特性和便捷的面向組件編程的支援成為.NET開發的慣用語言。2
Time of Update: 2015-07-04
標籤:在C#中如果需要把實值型別轉換成參考型別傳遞其他方法中並使其原來值發生改變,使用 ref 和 out 轉換成參考型別傳遞。1. ref : 使用ref之前需要定義變數並初始化(必須初始) class Program { static void Main(string[] args) { int i = 10; //定義變數,並初始化; Console.WriteLine(" i = " +