Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //1.將字串中的一些字母替換 string a = "123abc"; for (int i = 1;
Time of Update: 2018-12-04
合并兩個文字檔,這個思想很不錯,我很喜歡./*7-37-11-27-22.11.c -- 第七章第三十七題*/#include <stdio.h>int main (void) ;int main (void){FILE * fpa, * fpb, * fpc ;char cha, chb ;fpa = fopen ("a.txt", "r") ;fpb = fopen ("b.txt", "r") ;fpc = fopen ("c.txt", "w") ;if (NULL ==
Time of Update: 2018-12-04
//binarySearchTree.h -- 2011-07-27-17.14class binarySearchTree{public:enum direction {Direction_Left, Direction_Right} ;typedef int Item ;typedef struct node{Item item ;struct node * left, * right ;} Node ;private:Node * m_root ;int m_current ;Node
Time of Update: 2018-12-04
類比操作.菜單編輯得較簡單. 這個東西,很好.多了一手! 記憶體段錯誤,哎.要小心寫代碼.認真寫代碼./*8-7-12-01-22.47.c -- 第八章第七題*/#include <stdio.h>#include <stdlib.h>#define HEIGHT (0)#define SIZE (-1)#define OSS (-65536)typedef int Item ;typedef Item SetType ;typedef SetType *
Time of Update: 2018-12-04
老樣子,跟著演算法導論走.//graphRepresentAsAdjacentList.h -- graph header file.//2011-09-02-19.38 -- 2011-09-02-21.47//Purpose://Define a class "graphRepresentAsAdjacentList".//Declare methods of the class, and define element member.#include <iostream>#
Time of Update: 2018-12-04
//graphRepresentAsAdjacentList.cpp -- mplement file#include "stdafx.h"#include "graphRepresentAsAdjacentList.h"//Purpose://Define methods of class "graphRepresentAsAdjacentList".//Private methods://---------------------graphRepresentAsAdjacentList :
Time of Update: 2018-12-04
話說,半年前接觸過這個東西.昨天又接觸,發現書上給的方法很好.去一趟DFS,回來按照去的完成時間,即從後往前再次對轉置了的原圖進行DFS.就是這樣. 話說啊,來到了網吧,沒帶身份證,在二樓跟一群男童在一間屋子...傳完了出去準備晚飯,貌似今天心情突然好起來了. 同樣只是函數定義而已,沒有經過任何演算法的最佳化,完全就是按照主要的思想來進行的.最近演算法東西前進得不多,在看<<via>>,加油咯.貼吧.//2011-08-21-21.15 -- 2011-08-2
Time of Update: 2018-12-04
//nearTree.h -- 近親樹標頭檔#include <iostream>namespace tree{typedef int Item ;typedef struct node{Item item ;Item minOfAll, maxOfAll ;int minGap ;struct node * left, * right ;} Node ;const int INFINITY = ~(1 << 31) ;class
Time of Update: 2018-12-04
以下所討論,都是C++中的概念. 編譯代碼的時候,在符號表中,引用的地址是引用的變數的地址,指標的地址,是指標自身的地址.也就是說,引用本質上是不存在的,而指標是確實存在的.int a = 1 ;int & reference = a ;int * pointer = &a
Time of Update: 2018-12-04
呼,從12月開始,開始學習,使用C#了.還好自己之前是學過C和C++,學起來不那麼困難.特性很多,沒有貪多地去掌握. 在項目裡,暫時沒有我什麼事,自己在那,學習引擎,看服務端和用戶端的代碼.每天就是自己給自己找事情做,不然就會枯燥.有的時候啊,會比較悶的,忍咯,比從前的日子還是好過度多了. 這種程式,很久以前寫過一個.是用C寫的.這個呢,是C#,比C的功能多了許多.這個語言還是不錯,純物件導向.
Time of Update: 2018-12-04
在將各種類型的資料構造成字串時,sprintf 的強大功能很少會讓你失望。由於sprintf 跟printf 在用法上幾乎一樣,只是列印的目的地不同而已,前者列印到字串中,後者則直接在命令列上輸出。這也導致sprintf 比printf 有用得多。sprintf 是個變參函數,定義如下:int sprintf( char *buffer, const char *format [, argument] ... );除了前兩個參數類型固定外,後面可以接任意多個參數。而它的精華,顯然就在第二個參數:
Time of Update: 2018-12-04
using System;using System.Collections;public class Test{ static public Action A; static public Action<int> B; static public Action<int, string> C; static public Action<int, string, int> D; static public Action<int,
Time of Update: 2018-12-04
為使用malloc分配空間時報錯,錯誤碼如下:malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) – __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >=
Time of Update: 2018-12-04
規律:1). 每一個成員的地址能夠被它本身位元組數整除; 2). 最後總的位元組數必須能夠被最大位元組數的成員整除; 3). 一般可以以地址0為起始地址來考慮。否則的話就會產生補位。例如:typedef struct test {char a; //2bytesint b; //1byteschar d[21]; //20bytesdouble f;};結果sizeof(test)=4。實際上,1
Time of Update: 2018-12-04
orz下死月先。然後表示離散神馬的忘光了。一筆畫神馬的奇數度的點只有<=2個啊然後map<node,int>還有一點就是map是要鍵類型必須定義<操作符,而且該操作符能夠正確的工作,實際上map底層有紅/黑樹狀結構實現。根據二叉樹的特點重構<(感謝芒果==)#include<iostream>#include<cstdio>#include<cstring>#include<map>using namespace
Time of Update: 2018-12-04
1.把C++當成一門新的語言學習(和C沒啥關係!真的。); 2.看《Thinking In C++》,不要看《C++變成死相》; 3.看《The C++ Programming Language》和《Inside The C++ Object
Time of Update: 2018-12-04
搬運自:http://hi.baidu.com/evergreen19/blog/item/dbc1d5f13241c3a5a50f5245.html最近開始寫,RC4,由於要使用不少的swap,所以swap的演算法效率對RC4的整體速度是有著不小的影響的,因此總結了一些不錯的交換演算法與大家共用。int a=5,b=7;方法一: 內聯彙編,利用堆棧區 -- Swapping containers__asm{ push a push b pop a
Time of Update: 2018-12-04
做法:進行從小到大排序,這樣可以使最接近的幾個數都聚在一起,然後用(i-j+1)*a[i]-sum;sum-=a[j++];這樣可以以i-j+1為重複次數,算出重複最多的數,然後以為是從小到大排列的,又可以找出最小數。#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <utility>#define LL long long#
Time of Update: 2018-12-04
做法:傳統多重背包,好久沒做背包,有些地方確實要注意一下了...#include <iostream>#include <cstdio>using namespace std;int lim[12],dp[12][1003],c[12],d[12];int max(const int &a,const int &b){ return a>b?a:b;}int main(){ int n,m; lim[0]=-1; scanf(
Time of Update: 2018-12-04
C# WinForm下實現的發送郵件案例下載 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net;using System.Net.Sockets;namespace SendMail{