Location:
Search - char.rar
Search list
Description:
Platform: |
Size: 109372 |
Author: |
Hits:
Description: / 函数: void LCD_DataWrite(unsigned int Data)
// 描述: 写一个字节的显示数据至LCD中的显示缓冲RAM当中
// 参数: Data 写入的数据
// 返回: 无
// 备注: 无
// 版本:
// 2007/01/09 First version
//==============================================================
void LCD_DataWrite(unsigned char Dat)//,_Fill_Dot_LCD
{
unsigned char Num;
LCD_CS = 0;
LCD_A0 = 1;
for(Num=0;Num<8;Num++)
{
if((Dat&0x80) == 0) LCD_SDI = 0;
else LCD_SDI = 1;
Dat = Dat << 1;
LCD_CLK = 0;
LCD_CLK = 1;
}
LCD_CS = 1;
}
//==========================================================
// 函数: void LCD_RegWrite(unsigned char Command)
// 描述: 写一个字节的数据至LCD中的控制寄存器当中
// 参数: Command 写入的数据,低八位有效(byte)
// 返回: 无
// 备注:
// 版本:
// 2007/01/09 First version
//===============================================================
void LCD_RegWrite(unsigned char Command)
{
unsigned char Num;
LCD_CS = 0;
LCD_A0 = 0;
for(Num=0;Num<8;Num++)
{
if((Command&0x80) == 0) LCD_SDI = 0;
else LCD_SDI = 1;
Command = Command << 1;
LCD_CLK = 0;
LCD_CLK = 1;
}
LCD_CS = 1;
}
Platform: |
Size: 3361 |
Author: dpy18@163.com |
Hits:
Description: 实验三:C++编程入门
一、实验内容
1. 类模版。
2. 运算符重载。
3. 友元。
4. 继承。
二、实验题目
1, 设计一个类SavingsAccount,定义一个静态数据成员记录存款的年利率(rate),该类的每个成员都包含一个私有的数据成员balance,表示该成员当前的存款数额。提供一个成员函数CalMonthlyInterest(),用以计算月利息(用balance乘以rate再除以12),并将这个月利息加入balance中。提供一个静态成员函数ModifyRate(),用以改变静态数据成员rate的值。定义两个不同的SavingsAccount对象saver1和saver2,当前存款数额balance分别为2000.00和3000.00。首先将rate设置为3%,计算每个存款人的月息并打印新的结果,然后将rate设置为4%,再次计算每个存款人的月息并打印新的结果。
2, 设计一个学生类student,包括学生学号、姓名、成绩;设计一个友元函数,比较某两个学生成绩的高低;读入一个文本文件(格式如示例studengt.txt,每行的学号、姓名、成绩之间用四个空格隔开)中所有学生的学号、姓名、成绩,输出最高成绩和最低成绩的学生信息(学号、姓名、成绩)。
3, 阅读下面例子,将题中的Time类声明为Data类的友元类,通过Time类中的display函数引用Data类的私有数据,输出年、月、日和时、分、秒。
#include <iostream>
using namespace std;
class Date; //对Date类的提前引用声明
class Time //定义Time类
{
public:
Time(int,int,int);
void display(Date &); //display是成员函数,形参是Date类对象的引用
private:
int hour;
int minute;
int sec;
};
class Date //声明Date类
{
public:
Date(int,int,int);
friend void Time∷display(Date &); //声明Time中的display函数为友元成员函数
private:
int month;
int day;
int year;
};
Time∷Time(int h,int m,int s) //类Time的构造函数
{
hour=h;
minute=m;
sec=s;
}
void Time∷display(Date &d) //display的作用是输出年、月、日和时、分、秒
{
cout<<d.month<<″/″<<d.day<<″/″<<d.year<<endl; //引用Date类对象中的私有数据
cout<<hour<<″:″<<minute<<″:″<<sec<<endl; //引用本类对象中的私有数据
}
Date∷Date(int m,int d,int y) //类Date的构造函数
{
month=m;
day=d;
year=y;
}
int main( )
{
Time t1(10,13,56); //定义Time类对象t1
Date d1(12,25,2004); //定义Date类对象d1
t1.display(d1); //调用t1中的display函数,实参是Date类对象d1
return 0;
}
4, 将下面程序改为在类模板外定义各成员函数:
#include <iostream>
using namespace std;
template<class numtype> //定义类模板
class Compare
{
public:
Compare(numtype a,numtype b)
{
x=a;y=b;
}
numtype max( )
{
return (x>y)?x:y;
}
numtype min( )
{
return (x<y)?x:y;
}
private:
numtype x,y;
};
int main( )
{
Compare<int> cmp1(3,7); //定义对象cmp1,用于两个整数的比较
cout<<cmp1.max( )<<″ is the Maximum of two integer numbers.″<<endl;
cout<<cmp1.min( )<<″ is the Minimum of two integer numbers.″<<endl<<endl;
Compare<float> cmp2(45.78,93.6); //定义对象cmp2,用于两个浮点数的比较
cout<<cmp2.max( )<<″ is the Maximum of two float numbers.″<<endl;
cout<<cmp2.min( )<<″ is the Minimum of two float numbers.″<<endl<<endl;
Compare<char> cmp3(′a′,′A′); //定义对象cmp3,用于两个字符的比较
cout<<cmp3.max( )<<″ is the Maximum of two characters.″<<endl;
cout<<cmp3.min( )<<″ is the Minimum of two characters.″<<endl;
return 0;
}
5, 有两个矩阵a和b,均为2行3列,求两个矩阵的和。重载运算符“+”使之用于矩阵相加。如:c=a+b。重载插入运算符“<<”和流提取运算符“>>”,使之能用于该矩阵的输入和输出。
6, 利用类继承分别完成一个学生类、一个大学生类、一个本科生类,本科生类中包括了一个学生作为他的班长。在创建一个本科生对象时赋予他的全部信息,输出该本科生对象的全部信息。
7, 利用c++继承、多态虚函数、构造函数完成以下程序:设计人、老师、学生、大学生、研究生、大四学生等类、其主要属性自己定义,要求包括以下方法:
1) 构造函数,创建对象的主要信息
2) Display,显示每种类对象的主要信息
此外,要求每个类包含一个生日对象,其类型为Birthday类,学生类应该包含一个班主任对象,其类型为老师类。
三、实验要求
将程序源代码压缩后提交至学院FTP上对应实验和班级的目录中。
作业命名方式为:“学号姓名.rar”。
作业提交时间:下次实验课前提交。
Platform: |
Size: 1255695 |
Author: zhuchao0731@163.com |
Hits:
Description: 这是汉字系统源代码,是一个非常好的已是一个非常全面的汉字系统源代码-This is the Chinese character system source code, is a very good is a very comprehensive system of Chinese characters source code
Platform: |
Size: 1862656 |
Author: 黄小波 |
Hits:
Description: 读取配置文件(ini格式)的程序,可返回int,char*,float类型等的配置项数值。-Read configuration file (ini format) procedures can return int, char*, float type of configuration item values.
Platform: |
Size: 3072 |
Author: 钱睿硕 |
Hits:
Description: 本代码包为本人的一篇文章<一个占用内存极少的菜单系统的实现>在在PC上的测试移植代码。
------------------------------
Menu_Src目录为Menu的源代码
Ks0108.C的void Display_Locate(unsigned char DisplayData, unsigned char X, unsigned char Y)函数为最底层的显示函数。
该函数调用LCD模拟函数来完成显示。
KeyScan.C的unsigned char KeyScan(void)函数为键盘模拟函数。
void DelayMs( WORD time ) 延时
------------------------------
GUI_SIM.exe为编译后的文件,可以直观看到这个GUI的效果.
PC键盘的4个按键控制菜单周转:
PC按键 菜单中功能
up 向上键 确定键 进入子菜单
down向下键 取消键 返回父菜单
left向左键 向上键 菜单项上一项
right向右键 向下键 菜单项下一项
有兴趣自己编译VC工程:\Project\Menu.dsw
<一个占用内存极少的菜单系统的实现>相关PDF文档和其他资料在以下链接:
http://www.ouravr.com/bbs/bbs_content.jsp?bbs_sn=798580&bbs_page_no=3&bbs_id=9999
-err
Platform: |
Size: 797696 |
Author: huhb |
Hits:
Description: 字符液晶驱动C程序!
控制器为HD44780 or KS0066等兼容IC
-LCD testing procedures for char. LCD
Platform: |
Size: 8192 |
Author: 刘小姐 |
Hits:
Description: 内容摘要: LHD6000主板主芯片程序 ISD1730时序说明:
参考:void Send_1Byte(uchar ucData_s)和uchar Receive_1Byte(void)的说明.
应先发"RESET"命令再发"PWR_UP"命令,后发"RESET"命令可能不正常工作.
1730最高地址只有0xFF,所以对指定地址的操作函数的参数使用了"unsigned char"类型,
17系列的其它型号可能才用得到"unsigned int",借用时注意,将对应注释掉的部分还原.-Abstract: LHD6000 motherboard main chip program
Platform: |
Size: 481280 |
Author: yanzheng |
Hits:
Description: 简单路径,#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <queue>
#include <stack>
using namespace std
struct ArcNode
{
int adjvex
ArcNode *nextarc
}
typedef char VertexType
struct VNode
{
int data
ArcNode *firstarc -sample.rar
Platform: |
Size: 12288 |
Author: 张宏 |
Hits:
Description: 上期综合交易平台CTP API及文档
http://202.109.110.121/index.htm
CTP API http://202.109.110.121/api/
海洋部落 http://www.oceantribe.org
程序化交易者论坛 http://www.programtrader.net/
Compilation:
mv thosttraderapi.so libthosttraderapi.so
g++ -L./ -lthosttraderapi tradeapitest.cpp
Download:
wget http://202.109.110.121/api/lin64api.rar
快期交易系统, 基于CTP的模拟交易系统, 帐号352032密码888888, www.kuaiqi.net, http://202.109.110.121/sim.htm
服务器地址:
char demoTradeUrl[] = "tcp://asp-sim2-front1.financial-trading-platform.com:26205"
char demoQuoteUrl[] = "tcp://asp-sim2-md1.financial-trading-platform.com:26213" -On a comprehensive trading platform CTP API and documentation http://202.109.110.121/index.htm the CTP API http://202.109.110.121/api/ marine tribes http://www.oceantribe.org programmed traders forum zh- cn © 2005, douban.com/www.programtrader.net/ Compilation: mv thosttraderapi.so libthosttraderapi.so g++-L. /-lthosttraderapi tradeapitest.cpp Download: wget http://202.109.110.121/api/lin64api.rar fast of trading system, based on the CTP simulated trading system, account number 352 032 Password 888 888, www.kuaiqi.net, http://202.109.110.121/sim.htm server address: demoTradeUrl a char [] = " tcp ://asp-sim2-front1.financial-trading-platform . com: 26205 " char demoQuoteUrl [] =" tcp ://asp-sim2-md1.financial-trading-platform.com: 26213 "
Platform: |
Size: 2952192 |
Author: dolf |
Hits:
Description:
1、首先需要定义的对象:
SOCKET ReceivingSocket //接收端的Socket
SOCKADDR_IN ReceiverAddr //接收端的地址信息
char ReceiveBuf[1024] //接收数据缓冲区大小
int BufLength //缓冲区长度
SOCKADDR_IN SenderAddr //发送数据端地址信息
int SenderAddrSize = sizeof(SenderAddr) //发送端地址信息的长度
2、启动WSA动态库:
WSAStartup(MAKEWORD(2,2),&wsd)
3、创建socket:
ReceivingSocket=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP)
4、初始化服务器地址及监听端口
ReceiverAddr.sin_family=AF_INET //家族
ReceiverAddr.sin_port=htons(9000) //设置端口号
ReceiverAddr.sin_addr.s_addr=htonl(INADDR_ANY) //地址
5、绑定端口
6、接收数据:
ReceivingSocket,//接收端Socket
ReceiveBuf,//接收端用来存储数据的缓冲区
BufLength,//缓冲区的大小
0,//接收的附加选项,设置为0即可
(SOCKADDR*)&SenderAddr,//发送端的Socket地址
&SenderAddrSize//发送端Socket地址的大小 )
7、关闭socket,关闭WSA,1, you first need to define the object: the SOCKET ReceivingSocket // the the receiving end Socket SOCKADDR_IN distant ReceiverAddr // the receiving end the address information char ReceiveBuf of [1024] / / receive data buffer size int BufLength // buffer length SOCKADDR_IN distant SenderAddr // send data end address information int SenderAddrSize = sizeof (SenderAddr) // length of the address information of the sender, start WSA dynamic library: the WSAStartup (MAKEWORD (2,2), & wsd) 3, create socket: ReceivingSocket = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP) initialize server address and listen port ReceiverAddr.sin_family = AF_INET //family ReceiverAddr.sin_port = htons (9000) //set port number ReceiverAddr.sin_addr.s_addr = htonl (INADDR_ANY) //address 5, binding port 6 the the receiver Data: ReceivingSocket,// receiving end the the Socket ReceiveBuf,// receiving end is used to store data buffer BufLength// buffer size 0,//
Platform: |
Size: 5223424 |
Author: xiaoxiao |
Hits:
Description: Split the /dev/nvram part (that one can use drivers/char/generic_nvram.rar) from the arch & partition parsing code.
Platform: |
Size: 4096 |
Author: ruidanxan |
Hits:
Description: Char Matcher implements Predicat Source Code for Andriod.
Platform: |
Size: 7168 |
Author: rerhaca |
Hits:
Description: .A specialized {@link Reader} for reading the contents of a char array.
Platform: |
Size: 3072 |
Author: mongverca |
Hits:
Description: Char Buffer extends Buffer implements Source Code for Andriod.
Platform: |
Size: 5120 |
Author: reiwouwing |
Hits:
Description: PCF8563时钟芯片就用程序C:
本程序包含:PCF8563.C和PCF8563.h及PCF8563电路图片三个文件IIC用的是软件模拟IIC
程序已调好,所有功能正常,主要函数有:
void iic_start(void)
void iic_stop(void)
void Master_ACK(void)
void Master_NOACK(void)
void check_ACK(void)
void IICSendByte(unsigned char ch)
unsigned char IICreceiveByte(void)
void write_CFGbyte(unsigned char CFG_add,unsigned char CFG_data)
unsigned char receive_CFGbyte(unsigned char idata CFG_add)
void receive_CFGNbyte(unsigned char CFG_add, unsigned char n,unsigned char * buff)
void P8563_Readtime()
void P8563_settime()
void P8563_init()
移植好程序后,只要用到:--基于51平台,
void P8563_Readtime()
void P8563_init()
两个程序就可以。
如果是使用硬件IIC,只要修改(有些可以不要了):
void iic_start(void)
void iic_stop(void)
void Master_ACK(void)
void Master_NOACK(void)
void check_ACK(void)
-PCF8563 clock chip on the application C:
The program includes : PCF8563.C and PCF8563.h and PCF8563 circuit picture with the three documents software simulation IIC IIC
Procedures have been fine, all functioning properly , the main functions are:
void iic_start (void)
void iic_stop (void)
void Master_ACK (void)
void Master_NOACK (void)
void check_ACK (void)
void IICSendByte (unsigned char ch)
unsigned char IICreceiveByte (void)
void write_CFGbyte (unsigned char CFG_add, unsigned char CFG_data)
unsigned char receive_CFGbyte (unsigned char idata CFG_add)
void receive_CFGNbyte (unsigned char CFG_add, unsigned char n, unsigned char* buff)
void P8563_Readtime ()
void P8563_settime ()
void P8563_init ()
After transplantation good program, just use :- Based on 51 platforms
void P8563_Readtime ()
void P8563_init ()
Both programs can be.
If you are using hardware IIC, as long as the modifications ( some can do a ) :
void iic_start (void)
void iic_stop (
Platform: |
Size: 231424 |
Author: 张礼富 |
Hits: