Time of Update: 2018-12-05
#include<QApplication>#include<QLabel>#include<QLineEdit>#include<QGridLayout>int main(int argc, char *argv[]){ QApplication a(argc, argv); //建立一個視窗,並設定標題 QWidget *window = new QWidget;
Time of Update: 2018-12-05
#include <QtCore/QCoreApplication>#include<QFile>#include<QString>#include<QDebug>#include<QTextStream>void write(QString& fileName){ QFile mFile(fileName); //判斷是否成功開啟 if ( ! mFile.open( QFile::WriteOnly |
Time of Update: 2018-12-05
QFileInfo類參考QFileInfo用於提供與系統無關的檔案資訊#include<QFileInfo>Public Types flagsPermissionSpecPublic Functions QFileInfo () QFileInfo ( const QString & file ) QFileInfo ( const QFile & file ) QFileInfo (
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 REDEFINE_VECTOR_H_#define REDEFINE_VECTOR_H_#include"stdafx.h"#include<memory>#include<cstring>#include<fstream>#include<cstdlib>template<typename T,typename allocator=std::allocator<T> >class
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
#include "stdafx.h"#include"stdio.h"int main(int argc, char* argv[]){int *temp;int b=99;temp=&b;printf("temp is:%d\n",temp);printf("b is:%d\n",b);printf("b's addr is:%d\n\n",&b);*temp++=1;printf("temp is:%d\n",temp);printf("b
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
#include<pic.h>#define uchar unsigned char#define uint unsigned int#define rs_h (PORTC|=0x01)#define rs_l (PORTC&=0xfe)#define rs_o (TRISC&=0xfe)#define rw_h (PORTC|=0x02)#define rw_l (PORTC&=0xfd)#define rw_o
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
最近在做STM32正交編碼測速,下載了一個貌似官方提供的一個程式,但是看不懂,希望看到貼的大俠不吝賜教。s16 ENC_Get_Electrical_Angle(void)//s16 int16_t{s32 temp;temp=(s32)(TIM_GetCounter(ENCODER_TIMER))*(s32)(UINT32_MAX/(4*ENCODER_PPR));//s32 int32_t return((s16)(temp/65536)); // s16 result}/*********
Time of Update: 2018-12-05
#include<pic.h>#define uchar unsigned char#define uint unsigned intuchar i,temp;uchar count;void delay(uint x)//1ms{uint y,z;for(y=x;y>0;y--)for(z=25;z>0;z--);}void init(void){T1CON=0x01;//使能定時器1,時鐘為外部晶振四分頻PIE1|=0x01;//允許中斷INTCON|=0xc0;//
Time of Update: 2018-12-05
QKeyEvent類參考QKeyEvent類用於描述鍵盤按鍵所產生的QT事件#include<QKeyEvent>繼承於QInpueEvent公有函數:QKeyEvent ( Type type, int key, Qt::KeyboardModifiers modifiers, const QString & text = QString(), bool autorep = false, ushort count = 1 ) int count ()
Time of Update: 2018-12-05
功能說明:LCD1602液晶顯示年、月、日、時、分、秒、星期、溫度,三個按鍵控制時間日期調整以及鬧鐘設定。 三個按鍵:1、“校時”鍵,每次按下分別對應調整秒、調整分鐘、調整小時、調整星期、調整日、調整月份、調整年份、調整鬧鐘分鐘、調整鬧鐘小時、退出校時模式;2、“增加/開鬧鐘功能”鍵,校時模式下按下此鍵則數值加一,非校時模式下按下此鍵則顯示出鬧鐘時間並開啟鬧鐘功能(螢幕顯示字母A);3、“減小/關鬧鐘功能”鍵,校時模式下按下此鍵則數值減一,非校時模式下按下此鍵則關閉鬧鐘顯示並關閉鬧鐘功能(螢幕字
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
自學真難,隨便碰到個問題,都要百度半天、一天、兩天and so on...... 從開始寫DS18B20的程式到現在已經四天了,還沒有全部成功。以前寫程式,參考的晶片資料都是中文的,感覺英語的看著頭大,也看不懂,所以就沒想著要去參考參考原廠的datasheet,看了兩天的中文資料,這個看了寫的程式不正確,馬上再下一個,結果案頭上下的DS18B20的資料放了一大片,程式還是不正確。
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
如果你想要把一個容器內的所有元素累加起來,應該怎麼辦?STL 的 accumulate 可以讓我們不必自己寫迴圈:#include <iostream>#include <functional>#include <numeric>#include <vector>#include <string>int main(){ std::vector<int> vect; vect.push_back(1);
Time of Update: 2018-12-05
QTimerEvent類提供了一些用於描述定時器事件的參數。#include<QTimerEvent>Inherits: QEvent.Public Functions QTimerEvent ( int timerId ) int timerId () const詳細描述: QTimerEvent類提供了一些用於描述定時器事件的參數。定時器事件按規定的時間間隔發送給對象用於啟動一個活多個定時器,