Time of Update: 2015-04-06
標籤:雙端隊列:函數描述c.assign(beg,end)c.assign(n,elem) 將[beg; end)區間中的資料賦值給c。將n個elem的拷貝賦值給c。c.at(idx) 傳回索引idx所指的資料,如果idx越界,拋出out_of_range。c.back() 傳回最後一個資料,不檢查這個資料是否存在。c.begin() 傳回迭代器重的可一個資料。c.clear() 移除容器中所有資料。deque<Elem>
Time of Update: 2015-04-06
標籤:c語言 迴文字串 判斷迴文字字串#include <stdio.h>void huiwen(char *str){ int len=0; int i; int flag; char *ch=str; while(*ch != '\0') { ch++; len++; }
Time of Update: 2015-04-06
標籤:棧是在一端進行插入和刪除的線性表。棧頂---允許插入、刪除的這一端,棧頂的當前位置是動態變化的;不允許插入和刪除的一端稱為棧底,棧底是固定不變得,當表中無元素時稱為空白棧。對棧的常用操作有:棧 初 始 化: Init_Stack() 初始條件:棧不存在 操作結果:構造了一個空棧判 斷 空: Empty_Stack() 若棧空,則返回為1,否則返回0入
Time of Update: 2015-04-06
標籤:直接 貼代碼。 代碼也很簡單,有什麼不會的跟帖留言。 #include <stdio.h>#include <string.h>#include <windows.h>/*#include "stdafx.h"#pragma comment(linker,"/subsystem:windows /entry:mainCRTStartup")void exit(){MessageBox(NULL,"wifi即將退出。","wifi",0);}*
Time of Update: 2015-04-06
標籤:迴文字串 strlen #include<stdio.h>;#include<string.h>;void huiwen( const char* str){int i;int flag;int len=strlen(str);char *ch=str;while(*ch!='\0'){ch++;}ch--;for(i=1;i<=len/2;i++){if(*ch==*str)
Time of Update: 2015-04-06
標籤:字串轉換成對應數字 c語言 <p align="left">例如:“12.34“ 返回12.34</p><p align="left"> “-123.34“ 返回-123.34</p><p align="left"&
Time of Update: 2015-04-06
標籤:可變參數列表 printf c語言 //用可變參數列表實現printf函數#include <stdio.h>#include <stdarg.h>void my_printf(const char *str,...){va_list fun;va_start
Time of Update: 2015-04-06
標籤:/*編寫遞迴函式編寫厄密多項式,函數應該和下面的函數原型匹配:int hermite(int n, int x) 厄密多項式是這樣定義的: n <= 0時,h(n(x)) = 1; n = 1時,h(n(x)) = 2*x; n >= 2時,h(n(x)) = 2*x*(h(n-1)(x)) - 2*(n-1)*(h(n-2)(x));編寫遞迴函式,函數應該和下面的函數原型匹配:int hermite(int n, int x)*/#include
Time of Update: 2015-04-06
標籤:c++ 教程 if while for 參考書籍:C++ Primer 5th代碼:https://github.com/alivebao/StudyofCPlusPlus1. Hello World學寫代碼的第一個程式-Hello
Time of Update: 2015-04-06
標籤:c++ 類 class 靜態 今天為了代碼更加簡潔,用了一個class MSGHelper來定義一些靜態成員變數和靜態成員函數。開始時,我的寫法是(不是真實代碼,只是舉例):<strong>class helper{static int index;static void
Time of Update: 2015-04-06
標籤:整數 各位元之和 遞迴 運算 c語言 //寫一個遞迴函式DigitSum(n),輸入一個非負整數,返回組成它的數字之和.//例如,調用DigitSum(1729),則應該返回1+7+2+9,它的和是19#include <stdio.h>int DigitSum(int n){int sum=0;int m=0
Time of Update: 2015-04-06
標籤:字串 反向排列 遞迴 c語言 //編寫一個函數reverse_string(char * string)(遞迴實現)//實現:將參數字串中的字元反向排列。//要求:不能使用C函數庫中的字串操作函數。#include <stdio.h>#include <assert.h>void reverse_string(char const
Time of Update: 2015-04-06
標籤: C#中一維動態數組(即列表)分ArrayList和List<T>兩種,其容量可隨著我們的需要自動進行擴充 一、ArrayList類(少用) ArrayList位於System.Collections命名空間中,所以我們在使用時,需要匯入此命名空間 ArrayList裡邊的資料類型是object,它類似於向量,可以儲存不同的資料類型在一個數組裡邊(轉換為了object) 下面是ArrayList的聲明:ArrayList list =
Time of Update: 2015-04-05
標籤:#include <iostream> //預先處理 注意:iostream不帶.hint main(){ std::cout << "Aloha World" << std::endl; return 0;}#include <iostream> //預先處理 注意:iostream不帶.h /*名字空間-namespace*/using namespace std; //定義以後,下面程式可以直接使用 int
Time of Update: 2015-04-06
標籤:這次的部落格記錄的是寫crc校正碼的過程。過程十分坎坷,好不容易快整完了結果虛擬機器崩了,程式也沒了,只好重新來過。。。首先是控制台應用程式的代碼。 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.IO; 7 8 9 namespace
Time of Update: 2015-04-06
標籤:1.Interface 定義結構1 [attributes] [access-modifiers] interface interface-name [:base-inteface-list] 2 { 3 interface body 4 }[attributes] 性質 (可選項);[access-modifiers] 存取修飾詞 (可選項);//public internal private protected
Time of Update: 2015-04-06
標籤:c# 介面設計 介面 .net 登陸介面最主要的就是資料庫訪問,這裡就不多講介面設計了,直接給代碼:(這段代碼加在登陸按鈕的事件裡)#region 定義使用者資訊變數 string UserName = TextBox_User_Name.Text.Trim();
Time of Update: 2015-04-06
標籤: 將秒數轉化成任意時間格式,可以使用C#的一個函數TimeSpan,看樣本: TimeSpan ts = new TimeSpan(0, 0, 3661); richTextBox2.Text = ts.Hours + "小時" + ts.Minutes + "分鐘" + ts.Seconds + "秒"; 也可以使用傳統的方法,看樣本: int TotleTime=3661;//秒
Time of Update: 2015-04-06
標籤:模式比對(Pattern Matching)是F#中非常好用的一種語言特性。估計很多人都希望在C#中能用到這樣的特性。 一句話解釋一下模式比對就是:建立一個函數可以接受和處理不同類型的運算式(包括不同參數及類型)。比如你寫了一個名為format的函數,可以處理運算式“x?(1+2)”中的變數、常量、加法和乘法。 Tomas Petricek在他的博文《Pattern matching in action using C# 6》中先抱怨了一下C#在這方面特性的不足,接著還推測了一下C#
Time of Update: 2015-04-06
標籤:對於泛型類的聲明 其中使用型別參數的構造類型,比如List<T>被稱為開放構造類型(open constructed type)而不使用型別參數的構造類型,例如List<int>被稱為封閉構造類型(closed constructed type)。 特別要強調的是不同型別參數的封閉構造類型之間是不共用靜態成員變數的。舉個例子using System;public class List<T> {