C/C++中计算时间程序

来源:互联网 发布:游戏多核优化的多吗 编辑:程序博客网 时间:2024/06/18 09:50
#include<iostream.h>#include<time.h>void main(){   clock_t start,finish;   double totaltime;   start=clock();   ……                     //把你的程序代码插入到这里面   finish=clock();   totaltime=(double)(finish-start)/CLOCKS_PER_SEC;   cout<<"\n此程序的运行时间为"<<totaltime<<"秒!"<<endl;}

这个程序只能计算到秒,并不够精确,求更加精确的时间计算方法!