很疑惑
很不解
stack.h
const int StackSize=100;
template<class T>
class Stack
{
private:
int top;
T data[StackSize];
public:
Stack()
{
top=-1;
}
~Stack()
{
}
void push(T x);
T pop();
bool stkempty()
{
if(top==-1)
return 1;
else return 0;
}
};
template <classT>
void Stack::<T> push(T x)
{
if(top<StackSize)
data[++top]=x;
else
break;
}
template <class T>
T Stack::<T> pop()
{
if(top==-1)
break;
else
T x=data[top--];
return x;
}
#include<iostream.h>
#include<fstream.h>
//#include<cstdlib.h>
#include<string.h>
#include"stack.h"
//using namespace std;
class txt
{
private:
fstream in;//文件输入输出对象
fstream out;
char file[30];//存放文件的名字
public:
txt();//构造函数原型
~txt()//析构函数
{
in.close();//关闭文件流操作
out.close();
}
void menu();//菜单
void create_txt();//创建文本
void add_txt_content();//添加文本
void show_content();//展示文本
void figure_out_lines();//计算行数
void figure_out_paragraph();//计算段数
void check_sign();//检查匹配符
};
void txt::menu()
{
cout<<" Main MENU "<<endl;
cout<<"********************************************************"<<endl;
cout<<" 1. create txt "<<endl;
cout<<" 2. add txt content "<<endl;
cout<<" 3. show content on the screen "<<endl;
cout<<" 4. figure out the total paragraph "<<endl;
cout<<" 5. figure out lines "<<endl;
cout<<" 6. check the signs "<<endl;
stack.h
const int StackSize=100;
template<class T>
class Stack
{
private:
int top;
T data[StackSize];
public:
Stack()
{
top=-1;
}
~Stack()
{
}
void push(T x);
T pop();
bool stkempty()
{
if(top==-1)
return 1;
else return 0;
}
};
template <classT>
void Stack::<T> push(T x)
{
if(top<StackSize)
data[++top]=x;
else
break;
}
template <class T>
T Stack::<T> pop()
{
if(top==-1)
break;
else
T x=data[top--];
return x;
}
#include<iostream.h>
#include<fstream.h>
//#include<cstdlib.h>
#include<string.h>
#include"stack.h"
//using namespace std;
class txt
{
private:
fstream in;//文件输入输出对象
fstream out;
char file[30];//存放文件的名字
public:
txt();//构造函数原型
~txt()//析构函数
{
in.close();//关闭文件流操作
out.close();
}
void menu();//菜单
void create_txt();//创建文本
void add_txt_content();//添加文本
void show_content();//展示文本
void figure_out_lines();//计算行数
void figure_out_paragraph();//计算段数
void check_sign();//检查匹配符
};
void txt::menu()
{
cout<<" Main MENU "<<endl;
cout<<"********************************************************"<<endl;
cout<<" 1. create txt "<<endl;
cout<<" 2. add txt content "<<endl;
cout<<" 3. show content on the screen "<<endl;
cout<<" 4. figure out the total paragraph "<<endl;
cout<<" 5. figure out lines "<<endl;
cout<<" 6. check the signs "<<endl;