F_G

许多问题需要说清楚就可以&&走永远比跑来的重要

导航

C++ 一些常用函数的使用(1)

一、数学计算

#include <math.h>

1、上取整 double ceil(double)

int num;
int batchsize = 1000;
int batchnum = static_cast<int>(ceil((double)num/batchsize));

 2、下取整 double floor(double)

 

二、计时

#include <windows.h>

clock_t start,end;
start = clock();
....
end = clock();

double miaoshu = (double)(end-start) / CLOCKS_PER_SEC;

 

三、

posted on 2015-06-25 20:50  F_G  阅读(309)  评论(0编辑  收藏  举报