zoukankan      html  css  js  c++  java
  • 计算一个程序的运行时间

    /*
    程序的版权和版本声明部分:
     Copyright (c) 2013, 烟台大学计算机学院
     All rights reserved.
     文件名称:test.cpp
     作    者:赵加响
     完成日期:2013 年 11 月 14 日
     版 本 号:v1.0
     对任务及求解方法的描述部分:
     输入描述:无
     问题描述:计算一个程序的运行时间
     程序输出:
     问题分析:略
    算法设计:略
    1*/
    
    
    #include <iostream>
    #include <ctime>
    using namespace std;
    int main (void)
    {
        int i,ran_num=0;
        double t1,t2;
        t1=time(0);
        //写入该程序
        double r;
        double h;
        double Area;
        cout<<"底面半径 r ";
        cin >>r;
        cout<<"高 h ";
        cin>>h;
        Area=r*r*3.14*h;
        cout<<"圆柱体的表面积  "<<Area<<endl;
        //改程序结束
        t2=time(0);
        cout<<"运行时间"<<t2-t1<<"秒!"<<endl;
        return 0;
    }
    


  • 相关阅读:
    头文件<stdarg.h>
    头文件<signal.h>
    头文件<setjmp.h>
    头文件<math.h>
    头文件<locale.h>
    头文件<limits.h>
    头文件<ctype.h>
    头文件<assert.h>
    PHP error_reporting
    八大排序算法
  • 原文地址:https://www.cnblogs.com/riskyer/p/3424181.html
Copyright © 2011-2022 走看看