标题:求程序的运行时间,这个怎么是零呢?麻烦大家帮我看看
取消只看楼主
Invariably
Rank: 2
等 级:论坛游民
帖 子:54
专家分:46
注 册:2010-9-18
结帖率:90%
已结贴  问题点数:0 回复次数:2 
求程序的运行时间,这个怎么是零呢?麻烦大家帮我看看
里面的一部分函数我没有发上来
#include<malloc.h>
#include<time.h>
#include<iostream.h>
               
#define maxsize 10/*分配内存空间*/
typedef int ElemType;
typedef struct
{
    ElemType  *elem;
    int length;//线性表的当前长度
    int listsize;//线性表大小.。。。。10
}sqlist;
int main()
{   
    time_t before,after,during;
    sqlist L;//一个顺序表
    initlist(&L);
    creatlist(&L);
    cout<<"排序前"<<endl;
    printlist(L);
    before=time(NULL);
    cout<<"排序前系统时间:"<<before<<endl;
    InsertSort(&L);
    after=time(NULL);
    cout<<"排序后系统时间:"<<after<<endl;
    cout<<"运行时间"<<after-before<<endl;
    cout<<"插入排序后"<<endl;
    printlist(L);
    return 0;

}
搜索更多相关主题的帖子: include before during 线性表 
2011-06-26 12:40
Invariably
Rank: 2
等 级:论坛游民
帖 子:54
专家分:46
注 册:2010-9-18
得分:0 
这个应该是精度太低了,数据多一点就不是零了
怎么样才能提高精度呢?
2011-06-26 12:49
Invariably
Rank: 2
等 级:论坛游民
帖 子:54
专家分:46
注 册:2010-9-18
得分:0 
谢谢!!!!!
2011-06-29 12:35



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




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

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