Time of Update: 2018-12-05
// roomage.cpp: 主專案檔案。#include "stdafx.h"#include<iostream>#include<cstdlib>#include<ctime>using namespace std;unsigned int sand(unsigned int (time(0) ) );/* 按原理來說是可以運用遞迴實現的,貌似很複雜*///template<typename T>struct room{int val;
Time of Update: 2018-12-05
#ifndef LINK_TABLE_H#define LINK_TABLE_H#include"stdafx.h"#include<iostream>#include<cstdlib>#include<ctime>#include<string>using namespace std;struct Tnode{int row,col,val;struct Tnode *right,*down;};void install(Tnode* head)
Time of Update: 2018-12-05
Server Error in '/ ' Application. -------------------------------------------------------------------------------- Runtime Error Description: An application error occurred on the server. The current custom error settings for this application preven
Time of Update: 2018-12-05
QbitArray類提供位操作序列。include<QBitArray>公有函數:QBitArray ()QBitArray ( int size, bool value = false )QBitArray ( const QBitArray & other )bool at ( int i ) constvoid clear ()void clearBit ( int i )int count () constint count ( bool on )
Time of Update: 2018-12-05
QWheelEvent 類參考QWheelEvent類包含用於描述滑鼠滑輪事件的相關參數。#include<QWheelEvent>繼承至:QInputEvent公有函數:QWheelEvent ( const QPoint & pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient =
Time of Update: 2018-12-05
#include<reg52.h>#define uchar unsigned char#define uint unsigned int#define PORT P3#define dula_h P2|=0x40#define dula_l P2&=0xbf#define wela_h P2|=0x80#define wela_l P2&=0x7fsbit cs=P2^0;sbit rd=P2^1;sbit wr=P2^2;uchar read;uchar
Time of Update: 2018-12-05
QMouseEvent類參考QMouseEvent類用於描述滑鼠事件include<QMouseEvent>繼承於QInputEvent.公有函數:QMouseEvent ( Type type, const QPoint & position, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )QMouseEvent ( Type type, const
Time of Update: 2018-12-05
程式思路與缺陷參考:51單片機(AT89C52)矩陣鍵盤檢測程式#include<iom16v.h>typedef unsigned char uchar;typedef unsigned int uint;#define dula_hPORTD|=0x01#define dula_lPORTD&=0xfe#define wela_hPORTD|=0x02#define wela_lPORTD&=0xfd#define keyport PORTB#define
Time of Update: 2018-12-05
#include<pic.h>typedef unsigned char uchar;typedef unsigned int uint;#define rs_h PORTC|=0x01#define rs_l PORTC&=0xfe#define rw_h PORTC|=0x02#define rw_l PORTC&=0xfd#define en_h PORTC|=0x04 #define en_l PORTC&=0xfb#define rst_h
Time of Update: 2018-12-05
QAbstractFileEngine類參考QAbstractFileEngine類為訪問檔案系統提供了一些抽象概念。#include<QAbstractFileEngine>繼承於QFSFileEngine附註:該類的所有函數都是被新收入的,該類在QT4.1中有被介紹Public Types : classExtensionOption classExtensionReturn classMapExtensionOption
Time of Update: 2018-12-05
一直想整理一下對於meta-programming的一些想法,就從這個最簡單的開始吧!if_c是boost::mpl庫提供的一個元編程演算法,它接受三個模板參數,第一個是bool類型,後面兩個是類型名:template< bool c , typename T1 , typename T2 >struct if_c{ typedef unspecified
Time of Update: 2018-12-05
自學真難,隨便碰到個問題,都要百度半天、一天、兩天and so on...... 從開始寫DS18B20的程式到現在已經四天了,還沒有全部成功。以前寫程式,參考的晶片資料都是中文的,感覺英語的看著頭大,也看不懂,所以就沒想著要去參考參考原廠的datasheet,看了兩天的中文資料,這個看了寫的程式不正確,馬上再下一個,結果案頭上下的DS18B20的資料放了一大片,程式還是不正確。
Time of Update: 2018-12-05
有些時候我們希望一個類成員除了自己的值以外,還能有一個“未被初始化”的狀態,例如在一個 Server 裡面,我們需要管理 user 數量:class Server{//... int userCount_;//...};userCount_ 當然是初始化為0,但是有時候並不如此簡單,很多資源可能是在第一個 user 使用的時候被分配的,而回收資源的時候,如果僅僅看到 userCount_ 為0,我們壓根就不知道到底是曾經有過 user
Time of Update: 2018-12-05
QLayoutItem類參考QLayoutItem為布局操作提供了抽象條款。#include<QLayoutItem>Inherited by: QLayout, QSpacerItem, and QWidgetItem. Public Functions QLayoutItem ( Qt::Alignment alignment = 0 ) virtual~QLayoutItem () Qt::Alignmentalignment (
Time of Update: 2018-12-05
上次提到過為容器產生資料的問題,我給出的用 boost.lambda 的方法是: std::vector<int> vect(10); int i = 0; std::for_each( vect.begin(), vect.end(), _1 = ++var(i) );不錯,這樣可以產生連續的數字,也還算比較簡潔,因為代碼量不會隨著容器的大小而變化,不過,如果要在容器內填入隨機數呢?其實比上面更簡單,因為 STL 的 generate 演算法就是設計來做這個的: std::
Time of Update: 2018-12-05
MPL 是一個非常聰明的作品,在發揮 C++ 範本威力這方面登峰造極,而其介面的優雅、設計的一致性和思想的完整性讓 Loki 這樣類似的作品也相形見絀。廢話少說,我們上代碼。#include <string>#include <iostream>#include <boost/mpl/list.hpp>#include <boost/mpl/find.hpp>#include
Time of Update: 2018-12-05
#include<reg52.h>#define uchar unsigned charuchar rtemp,sflag;void SerialInit()//11.0592M晶振,傳輸速率9600{TMOD=0x20;//設定定時器1工作方式為方式2TH1=0xfd;TL1=0xfd;TR1=1;//啟動定時器1SM0=0;//串口方式1SM1=1;REN=1;//允許接收PCON=0x00;//關倍頻ES=1;//開串口中斷EA=1;//開總中斷}void
Time of Update: 2018-12-05
#include<time.h>#include<stdio.h>void main(){ /*方法1time_t curTime = time(NULL);char* curDate =
Time of Update: 2018-12-05
Boost.Lambda 的確是一個好東西,用來舉例最多的恐怕就是這個了:using namespace boost::lambda;std::vector<int> v;// init valuesstd::for_each(v.begin(), v.end(), std::cout << _1 << ' ');精緻、優雅、易於理解,下面是一個更漂亮的例子:std::map<int, int> values;// init valuesstd::
Time of Update: 2018-12-05
#include<iom16v.h>#define uchar unsigned char#define uint unsigned int#define cs_l PORTD&=0xfe//輸出低電平#define wr_l PORTD&=0xfd//輸出低電平void delayms(uint x)//8M晶振下延時1ms{uint y,z;for(y=x;y>0;y--)for(z=1325;z>0;z--);}void main(){uchar