标题:高手来看看错在那里啊
取消只看楼主
jianfeng520
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-12-16
 问题点数:0 回复次数:0 
高手来看看错在那里啊
#include<iostream.h>
#include<time.h>
//----------------------------------------
inline int comp1(int x,int y){return (x>y) ? x:y;}
int comp2(int x,int y){return (x>y) ? x:y;}
//------------------------------------------
void mian()
{
    double t1,t2;
    t1=(double)clock();
    for(int m=0;m<10000;m++)
       for(int n=0;n<10000;n++)
           comp1(m,n);
       t2=(double)clock();
       cout<<"调用内联函数的运行时间:\t"<<(t2-t1)/CLK_TCK<<"秒\n";//CLK_TCK为1000常量

       t1=(double)clock();
       for(int m=0;m<10000;m++)
           for(int n=0;n<10000;n++)
               comp2(m,n);
           t2=(double)clock();
           cout<<"调用外部函数的运行时间:\t"<<(t2-t1)/CLK_TCK<<"秒\n";

           t1=(double)clock();
           for(int m=0;m<10000;m++)
               for(int n=0;n<10000;n++)
                   (m>n)?m:n;
               t2=(double)clock();
               cout<<"直接运算时间:\t"<<(t2-t1)/CLK_TCK<<"秒\n";
}
//-----------------------------------------------
为什么会运行错 看不出来 请高手指点 是不是受编译器的影响啊?
搜索更多相关主题的帖子: include double return 
2008-03-06 15:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-202227-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.143753 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved