What?在计算中涉及不同数值类型的computation,这时候,C++会按照以下顺序进行转换order:long double>double>float>unsigned long>long>unsigned int>integ. (1) 1/2=0(当1和2都是int时),结果也肯定是int;...
分类:
编程语言 时间:
2014-06-21 10:09:58
阅读次数:
240
#include "aes.h"#include "modes.h"#include "e_os2.h"#include "aes_locl.h"#include "opensslconf.h"AES_KEY aes;//aes cbc模式加解密用到的向量unsigned char iv[AES_B...
分类:
移动开发 时间:
2014-06-20 22:20:17
阅读次数:
506
一、基本数据结构 1 union m_block 2 { 3 union m_block* next; 4 unsigned int size; 5 }; 6 7 struct m_list 8 { 9 union m_block* free;...
分类:
系统相关 时间:
2014-06-19 07:59:56
阅读次数:
309
移动鼠标并显示鼠标坐标struct MOUSE_DEC { unsigned char buf[3], phase; int x, y, btn;}; enable_mouse(&mdec); for (;;) { io_cli(); //...
分类:
其他好文 时间:
2014-06-19 06:55:18
阅读次数:
201
先从随机数的原理谈起.计算机的随机数都是由伪随机数,即是由小M多项式序列生成.产生每个小序列都有一个初始值,即随机种子.srand()产生随机种子.rand()产生随机数要保证计算机产生不相同的随机数,应保证它们的随机种子是不一样的.srand( (unsigned)time( NULL ) );就...
分类:
其他好文 时间:
2014-06-18 11:09:19
阅读次数:
196
输入一个年份,判断是否为闰年。判断闰年的方法是:如果该年能被4整除但不能被100整除;或者能被400整除,就是闰年。 1 #include 2 3 int main( int argc, char* argv[] ) 4 { 5 6 unsigned long year; 7 ...
分类:
其他好文 时间:
2014-06-18 09:42:30
阅读次数:
152
求最大公约数可采用辗转相除法,其流程如图所示。最小公倍数就是两个整数的乘积除以其最大公约数。 1 #include 2 3 int main() 4 { 5 unsigned long a, b, c=0; //两个整数和临时变量 6 unsigned long lc...
分类:
其他好文 时间:
2014-06-18 09:34:46
阅读次数:
243
就是判断一个数是否是素数,网上很多版本,我觉得都有点问题,今天一个朋友问我这个问题,我才知道,现在我就贴出自己的代码,很有用哦!!
#include
#include
int Prime(unsigned int a)
{
unsigned int i;
int k=0;
if (a==1) k=1;
else for(i=2;i
if(a%...
分类:
编程语言 时间:
2014-06-18 07:30:59
阅读次数:
210
一.对移位操作的基本概述:
1、什么样的数据类型可以直接移位
char、short、int、long、unsigned char、unsigned short、unsigned int、unsigned long都可以进行移位操作,而double、float、bool、long double则不可以进行移位操作。
2、有符号数据类型的移位操作
对于char、short、int、lon...
分类:
其他好文 时间:
2014-06-18 06:59:15
阅读次数:
260
程序代码:
#include
using namespace std;
class CTime//时间类
{
private:
unsigned short int hour; //时
unsigned short int minute; //分
unsigned short int second; //秒
public:
CTime(int h=0,int m=0,i...
分类:
其他好文 时间:
2014-06-17 16:07:31
阅读次数:
305