Time of Update: 2015-05-23
標籤:十幾年沒有寫 C 了,這可以說是重新學習,底下的程式是改寫自 W.Richard Stevens 的名著 - Networking APIs: Sockets and XTI,改寫的原因有二: (1) 在我的開發環境 scientific linux 7.0 上沒辦法正常 compile,可能是因為 Stevens 的程式是在 UNIX 上寫的,與 linux 上略有不同; (2) Stevens 用 #define
Time of Update: 2015-05-24
標籤: 第六章 利用數組批量處理資料數組是一組有序資料的集合,數組中的每一個元素都屬於同一資料類型。算是一種資料的組織圖。初現結構端倪。 一維數組定義:類型符 數組名[常量運算式] 數組名命名遵行標示符命名規則C語言中不允許對數組的大小作動態定義。說明:如果在被調用函數中定義數組,其長度可以是變數或非常量運算式。實參。此情況稱為可變長數組。若數組指定為靜態儲存方式,此方式不合法。引用:
Time of Update: 2015-05-23
標籤:字串 c++ 替換 #include <iostream>#include <malloc.h>#include <string.h>using namespace std;//將字串中的空格用%20替換。void Grial(char *str){ if(str==NULL)return ; char *p = str; char *
Time of Update: 2015-05-23
標籤: 一維數組:int a[c],其中a是數組名稱,c是數組維度,數組維度必須是常量運算式!例如:1 int c=3;2 int a[c];//錯誤!由於c不是常量運算式,所以該定義非法。若將c定義為const int,即c成為一個常量運算式,則可正常編譯。 數組的初始化:int a[3]={1,2};//正確!等價於a[3]={1,2,0}int b[3]={1,2,3,4};//錯誤!初始值過多。int
Time of Update: 2015-05-23
標籤: 為了監控web程式的靜態檔案是否被惡意改動,所以學習了一下FileSystemWatcher 類對檔案的監控,由於還在初級階段,這裡只貼一下關於FileSystemWatcher學習的一些代碼。 具體代碼如下:#using <System.dll>#include <iostream>using namespace std;using namespace System;using namespace System::IO;using
Time of Update: 2015-05-23
標籤: 在前面認識C中的結構體中我介紹了結構體的基礎知識,下面通過這段代碼來回顧一下: 1 #include<stdio.h> 2 #define LEN 20 3 4 struct Student{ //定義結構體 5 char name[LEN]; 6 char address[LEN]; 7 int age; 8 }; 9 10 int main(int argc, char* argv[])11 {12 struct
Time of Update: 2015-05-23
標籤:一、入門視頻:零起點學通C++(範磊)電子書:C++ Primer第三版、第四版http://pan.baidu.com/share/link?shareid=432594&uk=1211444507&third=15二、VC++學習視頻:1、VC++深入詳解(修訂版) http://pan.baidu.com/share/link?shareid=551213&uk=14
Time of Update: 2015-05-23
標籤:// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>#include <string.h>#include <stdio.h>using namespace std;typedef int ElemType;struct Stack{ ElemType *stack; int top; int maxSize;};void
Time of Update: 2015-05-23
標籤: 今天第一次來這裡寫隨筆,分享下自己的一些認知,可能微不足道,但是這卻是自己的小小突破。 在複習資料的結構的過程中,偶遇’\0‘,於是很奇怪為什麼’\0‘可以作為while()迴圈的結束標誌,下面是我對‘\0‘的測試。#include "stdafx.h"#include "stdio.h"int main(int argc, char* argv[]){char c[5]={‘A‘,‘ ‘,‘x‘,‘
Time of Update: 2015-05-23
標籤:c# 多 線程 參數 傳遞 1、通過實體類來傳遞(可以傳遞多個參數與擷取返回值),demo如下:需要線上程中調用的函數:namespace ThreadParameterDemo{ public class FunctionClass { public static string
Time of Update: 2015-05-23
標籤:// CTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>#include <string.h>#include <stdio.h>using namespace std;//class str{//private:// char s[80];//public:// str(char c[]){// strcpy(s,c);// }//
Time of Update: 2015-05-24
標籤:#include "csapp.h"/*編寫sleep的封裝函數,snooze函數,返回一個進程實際休眠了多少時間*/unsigned int snooze(unsigned int secs) //secs為總休眠時間{ unsigned int timeLeft; unsigned int timeAll=secs; ti
Time of Update: 2015-05-23
標籤: 剛裝的vs2010(32位win7系統),編譯時間出現錯誤:“VS2010 LNK1123: 轉換到 COFF 期間失敗:
Time of Update: 2015-05-23
標籤:#include <iostream>#include<string>using namespace std;string add(string s1,string s2){ string s0; int c=0;if(s1.size()<s2.size()){string ss;ss=s1;s1=s2;s2=ss;}int len1=s1.size()-1,len2=s2.size()-1;while(len1>=0){char m;if(
Time of Update: 2015-05-24
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace 中介者模式{ public abstract class Person { public string Name { get; set; } &
Time of Update: 2015-05-23
標籤:Compare 比較字串的內容,考慮文化背景(場所),確定某些字元是否相等CompareOrdinal 與Compare一樣,但不考慮文化背景Format 格式化包含各種值的字串和如何格式化每個值的說明符IndexOf 定位字串中第一次出現某個給定子字串或字元的位置IndexOfAny 定位字串中第一次出現某個字元或一組字元的位置LastIndexOf 與IndexOf一樣,但定位最後一次出現的位置 LastIndexOfAny
Time of Update: 2015-05-23
標籤:在最近,我們以小組的形式完成了一次比較正規的程式設計,並且在三個平台(window8.1,window
Time of Update: 2015-05-23
標籤:.net framework c# command datareader connectio
Time of Update: 2015-05-23
標籤: private void button1_Click(object sender, EventArgs e) { int recordx = this.Left; //指定表單左邊值 int recordy = this.Top; //指定表單上邊值 for (int i = 0; i < 10; i++) //抖動次數 { if (i % 2 ==
Time of Update: 2015-05-23
標籤:擷取當前星期幾實現這個功能有多種方法,接下來將列出3種供你參考,感興趣的你可不要錯過了哈,希望本文所提供的知識點對你有所協助第一種:string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };string week = Day[Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))].ToString();lbDay.Text =