如何计算一个程序的运行时间

#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;
}

全部评论

相关推荐

2025-12-23 18:51
中南大学 Java
唉又萌混过关:是不是那种收钱盖实习章的机构?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务