- 论坛徽章:
- 0
|
关于连接.h文件的问题!!!
我又这样编了一个程序,为什么会出错呢????
/////stack.h
enum error_code
{
sucess overflow underflow
}
typedef int stack_entry;
const int maxstack=10;
class stack
{
public:
bool empty() const;
error_code push(const stack_entry&item);
errer_code pop();
error_code top(stack_entry&item) const;
private:
int count;
stack_entry entry[maxstack];
}
///////////////define.cpp
bool stack::empty() const
{
bool outcome=true;
if(count>;0) outcome=false;
ruturn outcome;
}////////////////////////////////
error_code stack::pop()
{ error_code outcome=success;
if(count<0) outcome=underflow;
else
--count;
ruturn outcome;
}////////////////////////////
error_code stack::push(const stack_entry&item)
{error_code outcome=success;
if(count>;=maxstack) outcome=overflow;
else entry[count++]=item;
ruturn outcome;
}//////////////////////////////
error_code stack::top(stack_entry &item) const
{
error_code outcome=success;
if(count==0) outcome=underflow;
else item=entry[count-1];
return outcome;
////////////////reverse.cpp
#include<stack.h>;
#include<iostream.h>;
void main()
{
stack j;
int i,k;
cin>;>;i;
for(int n=0,n<i,i++)
{
cin>;>;k;
j.push(k);
}
while(!j.empty())
{
cout<<j.top();
j.pop();
}
}
这个程序只要是用栈实现一个倒序输出,运行时只有一个错误.如下:
fatal error C1083: Cannot open include file: 'stack.h': No such file or directory
请各位指教!!!谢谢 |
|