4:下面是某嵌入式系统的一些基本函数说明,代替标准c中的相关函数。
FREE()
Description:
This function corresponds to free() in the standard C library.
Prototype:
void FREE(void * po)
Parameters: po Points to the memory to be freed.
Return Value: None
MALLOC()
Description:
This function corresponds to malloc() in the standard C library. This function zeros the
memory that it returns.
Prototype:
void * MALLOC(DWORD dwSize)
Parameters: dwSize Size of buffer in bytes.
Return Value: Pointer to the allocated memory.
该系统不支持浮点数,只支持整数运算。但由于目前的程序当中对计算的要求精度相对较高,
希望你能设计一个类,来实现模拟小数的运算。(只需要实现加减乘除,并假设程序中所有参与
运算的数值和运算结果都在char的范围里。)
例如:
char a = 3;
char b = 2;
char c = a/b;
char d = 6/c;
结果d = 6;
我们希望通过你的类来实现运算,并得到的结果是 d = 4;
FREE()
Description:
This function corresponds to free() in the standard C library.
Prototype:
void FREE(void * po)
Parameters: po Points to the memory to be freed.
Return Value: None
MALLOC()
Description:
This function corresponds to malloc() in the standard C library. This function zeros the
memory that it returns.
Prototype:
void * MALLOC(DWORD dwSize)
Parameters: dwSize Size of buffer in bytes.
Return Value: Pointer to the allocated memory.
该系统不支持浮点数,只支持整数运算。但由于目前的程序当中对计算的要求精度相对较高,
希望你能设计一个类,来实现模拟小数的运算。(只需要实现加减乘除,并假设程序中所有参与
运算的数值和运算结果都在char的范围里。)
例如:
char a = 3;
char b = 2;
char c = a/b;
char d = 6/c;
结果d = 6;
我们希望通过你的类来实现运算,并得到的结果是 d = 4;
解决方案 »
- 请解释下(DEVICE_CONTEXT *)是什么意思
- 我要开始使用VC去控制PLC(网络版),应该先学习些哪些东西呢?
- 进程实体计数的问题
- 如何将 CString 转成 std::string?
- 提议
- 求教:CreateCompatibleBitmap()
- 大家看看下面的代码,错在哪了???
- 为什么OnDraw()没有被执行
- 请问如何获得系统中正在运行的应用程序的句柄?急!1在线等待!!!(有分)
- 用CSocket编程时,里面有好多的如atol,htonl,htons等xtox类型的函数,请问他们的作用是什么?我没装MSDN,书上又没讲
- 问一个win32api?
- VC怪事,即使我没有更改任何源代码文件,每次从VC中按下Ctrl+F5时,都提示说一些源代码文件需要重新bulit,而且每次都是同样的几个源代码
比如
3*10/2=15
6*10/15=4
{
int temp=x;
int countx=0;
while(temp!=0)
{
temp=temp/10;
countx++;//统计位数
}
int temp=y;
int county=0;
while(temp!=0)
{
temp=temp/10;
county++;//统计位数
}
if(county!=0)
{
switch(countx-county)
{
........................................//根据除数和被除数的位数关系确定该怎么乘以10的N次方,保证不超过DWORD,使结果不丢失有效数字
}}