标题:求助?
只看楼主
wwiilla
Rank: 1
等 级:新手上路
帖 子:51
专家分:0
注 册:2005-9-5
 问题点数:0 回复次数:0 
求助?

#include <iostream.h>
#include <iomanip.h>

class Stack1
{
public:
int date[4];
int top;
public:
Stack1(){ top = -1;}
~Stack1(){}
void push(int in);
int pop();
int full();
int empty();
};
void Stack1::push(int in)
{
if(!full());
date[++top] = in;
}
Stack1::pop()
{
if(!empty());
return date[top--];
}
Stack1::full()
{
return top = 3;
}
Stack1::empty()
{
return top = -1;
}
void main()
{
Stack1 a;
int i;
for(i=1;i<5;i++)
a.push(i);
for(i=0;i<4;i++)
cout << setw(5) << a.pop();
cout << endl;
}
怎么得不到正确结果?

搜索更多相关主题的帖子: return public include void top 
2005-11-03 17:11



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




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

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