自己用C编写的小游戏,DOS界面哦,可以运行。 浮点数基本运算 浮点数的基本运算主要有四则运算、符号处理、大小比较,以及浮点数分柝等。 包含头文件 "fn.hpp" #include "fn.hpp" 浮点数基本运算 浮点数的基本运算中有加、减、乘、除、取负、绝对值、相等比较等。 加减乘除 加、减、乘、除四个运算极为相似,都是需要两个参数,结果当然也是浮点数了。 例子: // 加 减 乘 除 btil::fn::plus<f1, f2>::value // f1+f2 的结果 btil::fn::minus<f1, f2>::value // f1-f2 的结果 btil::fn::multiplies<f1, f2>::value // f1*f2 的结果 btil::fn::divides<f1, f2>::value // f1/f2 的结果 plus<f1, f2>::value::f_val // f1+f2 的结果的值 struct one { static CONST double f_val = 1.0 } // 两个浮点数 struct two { static CONST double f_val = 2.0 } minus<two, plus<divides<one, two>::value, one>::value >::value::f_val == 0.5 取负 取负运算就是取一个浮点数的负数。
上传时间: 2014-12-06
上传用户:jichenxi0730
啥也不说了,请看代码示例 File : fat_dir.c FS_DIR *FS__fat_opendir(CONST char *pDirName, FS_DIR *pDir) { FS_size_t len FS_u32 unit FS_u32 dstart ....... FS_u32 dsize FS_i32 i char realname[12] char *filename if (!pDir) { return 0 /* No valid pointer to a FS_DIR structure */ }
标签:
上传时间: 2013-12-14
上传用户:梧桐
微生物膜生长的模拟,可以通过修改CONST的两个声明常量来修改运行时间
标签: 模拟
上传时间: 2014-01-17
上传用户:qilin
矩阵运算的算法 用Type类数组创建矩阵对象 matrix(int rows,int cols) //创建矩阵,值为0 matrix(int n) //创建单位阵 matrix(CONST matrix &) //拷贝构造函数 BOOL Ismatrixf(){ return (rows==cols) } //判断矩阵是否为方阵 modifyrowscols(int rows,int cols) //修改矩阵的行列数 ~matrix() {delete []elems } //析构函数
上传时间: 2015-07-14
上传用户:水口鸿胜电器
1. PL/0 语言介绍 ●PL/0 程序设计语言是一个较简单的语言,它以赋值语句为基础,构造概念有顺序、条件和重复(循环)三种。PL/0 有子程序概念,包括过程定义(可以嵌套)与调用且有局部变量说明。PL/0语言编译程序采用以语法分析为核心、一遍扫描的编译方法。词法分析和代码生成作为独立的子程序供语法分析程序调用。语法分析的同时,提供了出错报告和出错恢复的功能。在源程序没有错误编译通过的情况下,调用类PCODE解释程序解释执行生成的类PCODE代码。 ●保留字(关键字):所谓保留字是指在Pascal语言中具有特定的含义。标准Pascal语言中的保留字一共有35个,Turbo Pascal语言一共有51个。下面是Pascal语言的保留字:AND,ARRAY,BEGIN,CASE,CONST,DIV,DO,DOWNTO,ELSE,END,FILE,FOR,FUNTION,GOTO,IF,IN,LABEL,MOD,NIL,NOT,OF,OR,PACKED,PROCEDURE,PROGRAM,RECORD,REPEAT,SET,THEN,TO,TYPE,UNTIL,VAR,WHILE,WITH,EXPORTS,SHR,STRING,ASM,OBJECT,UNIT,CONSTRUCTOR,IMPLEMENTATION,DESTRUCTOR,USES,INHERITED,INLINE,INTERFACE,LIBRARY,XOR,SHL
上传时间: 2015-07-17
上传用户:zm7516678
[问题描述] 将N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前,要求使用最少的附加空间,且算法的时间复杂度为O(N) [输入] 待排序记录个数,各关键字的值。 [输出] 关键字从正负分开,正数在前 [存储结构] 待排序记录顺序存储。 [算法的基本思想] 快速排序算法每次任取一个记录的关键字为标准,将其余记录分为两组将,N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前。 #include <iostream> using namespace std #define MAXNUM 100//设文件的最长可能长度 void sort(int* keys, CONST int len)//排序
上传时间: 2014-01-13
上传用户:aig85
unit Video interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, stdctrls, ExtCtrls, avicap, mmsystem, dsgnintf // Types for event-procedures type TCapStatusProc = procedure(Sender: TObject) of object TCapStatusCallback = procedure(Sender: TObject nID: integer status: string) of object TVideoStream = procedure(sender: TObject lpVhdr: PVIDEOHDR) of object TAudioStream = procedure(sender: TObject lpWHdr: PWAVEHDR) of object // Property Editor for driver selection type TDrivereditor = class(TPropertyEditor) function GetAttributes: TPropertyAttributes override procedure GetValues(Proc: TGetStrProc) override function GetValue: string override procedure SetValue(CONST Value: string) override end
标签: interface Messages Graphics Controls
上传时间: 2013-12-21
上传用户:heart520beat
UC Library Extensions UnderC comes with a pocket implementation of the standard C++ libraries, which is a reasonably faithful subset. This documentation describes those UnderC functions and classes which are not part of the C++ standard. UC Library Builtin functions: Most of these are standard C functions, but there are a few unique to the UnderC system which give you runtime access to the compiler. You may evaluate expressions, execute commands, compile code, etc. * Expands the text in expr using the UnderC preprocessor, putting the result into buff. void uc_macro_subst(CONST char* expr, char* buff, int buffsize) * Executes a UC #-command, like #l or #help. uc_cmd() expects the name of the command, _without_ the hash, e.g. uc_cmd("l fred.cpp") or uc_cmd("help"). void uc_cmd(CONST char* cmd) * Evaluates any C++ expression or statement will return non-zero if unsuccessful.
标签: implementation Extensions libraries standard
上传时间: 2013-12-14
上传用户:leehom61
Delphi6.0函数大全,Delphi程序员的至爱。∷图书简介∷ 电子图书名:Delphi6函数大全 Delphi6函数大全(1) <> 首部 function AnsiResemblesText(CONST AText, AOther: string): Boolean $[StrUtils.pas功能 返回两个字符串是否相似说明 ANSI(American National Standards Institute)美国国家标准协会 不区分大小写参考 function StrUtils.SoundexProc var StrUtils.AnsiResemblesProc例子 CheckBox1.Checked := AnsiResemblesText(Edit1.Text, Edit2.Text)
上传时间: 2016-01-25
上传用户:mikesering
高质量C++编程 电子版 林锐 如果输入参数以值传递的方式传递对象,则宜改用“CONST &”方式来传递,这样可以省去临时对象的构造和析构过程,从而提高效率。 【规则6-2-2】函数名字与返回值类型在语义上不可冲突。 违反这条规则的典型代表是C标准库函数getchar。
上传时间: 2013-12-17
上传用户:CHENKAI