| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 402 人关注过本帖
标题:关于类定义
只看楼主 加入收藏
huangyan6611
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2009-4-29
结帖率:87.5%
收藏
 问题点数:0 回复次数:0 
关于类定义
顺序栈:
#include"iostream.h"
#include"time.h"
#include"stack.h"
#include"seqstack.h"
using namespace std;
void main()
{
    double tTime;
    const long number=100000;
    int temp=0;
    seqstack<int>st(2);
    tTime=time();
    for(int i=0;i<number;i++)
    {
        st.push(temp);
        st.pop(temp);
    }
    tTime=time()-tTime;
    cout<<"100000 times stack operators is"<<tTime<<endl;
}

链栈:
#include"iostream.h"
#include"time.h"
#include"stack.h"
#include"linkstack.h"
using namespace std;
void main()
{
    double tTime;
    const long number=100000;
    int temp=0;
    linkstack<int>st(2);
    tTime=time();
    for(int i=0;i<number;i++)
    {
        st.push(temp);
        st.pop(temp);
    }
    tTime=time()-tTime;
    cout<<"100000 times stack operators is"<<tTime<<endl;
}

本人菜鸟 初学C++数据结构  以上是一个测试程序的主函数,用来测量100 000个交替的堆栈添加和删除操作所需要的运行时间   

哪位高手能给加个顺序栈和链栈的类定义啊使之能正常运行啊  谢谢啦~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
搜索更多相关主题的帖子: 定义 
2009-11-25 08:14
快速回复:关于类定义
数据加载中...
 
   



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

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