#include<string.h>
#include<stdio.h>//基本输入输出包括在内
#include<stdlib.h>//清屏指令包括在内
#include<conio.h>//getch()等函数包括在内
#include<windows.h>//Sleep()函数包括在内
#define MAXSIZE 80
typedef struct{
char num[20];
}STUDENT;
//创建结构体
typedef struct{
int last;
STUDENT data[MAXSIZE];
}SeqList;
//定义顺序表
SeqList Input();//输入文章
void Display(SeqList *L);//显示文章
//void Statistics1(SeqList *L);//查询总字数
/*void Statistics2(Word w);//查询某一段文字出现的次数
void Delete(Word &w);*/ //删除一段文字
void memu();//二级菜单选择
int main()
{
SeqList L;
printf("正在启动\n");
Sleep(777);//延迟
char m;//选择
while(1)
{
system("cls");
printf("\n");
printf("--------------------------------------------------\n");
printf("********************文章编辑**********************\n");
printf("·························\n");
printf("***************输入序号选择功能*******************\n");
printf("*****1、文章输入 *****\n");
printf("*****2、显示文章内容 *****\n");
printf("*****3、统计各类字符数目及文章总字符数 *****\n");
printf("*****4、统计某一段文字在文中出现的次数 *****\n");
printf("*****5、删除某一段文字 *****\n");
printf("*****6、退出 *****\n");
printf("**************************************************\n");
printf("·························\n");
printf("--------------------------------------------------\n");
m=getch();
switch(m)
{
case'1':L=Input();
Display(&L);
getch();
system("cls");
break;//memu();break;
case'2':Display(&L);break;
// case'3':Statistics1(&L);break;
// case'4':Statistics2w(w);break;
// case'5':Delete(w);break;
case'6':return 0;
}
}
return 0;
}
SeqList Input()
{
SeqList list;
STUDENT s;
char num[10];
list.last=-1;
printf("请输入一篇文字每行不超过80个字符以‘#’结束\n");
while(1)
{
scanf("%s",num);
if(num[0]=='#')
break;
strcpy(s.num,num);
list.last=list.last+1;
list.data[list.last]=s;
}
return list;
}
void Display(SeqList *L)
{
int i=0,n;
n=L->last;
system("cls");
if(n==NULL)
{
printf("无文字\n");
printf("按任意键返回\n");
getch();
return;
}
while(i<=n)
{
printf("\n%-6s\t\t",L->data[i].num);
i++;
}
//getch();
}
/*void Statistics1(SeqList *L)
{
int
}*/
/*void memu()//二级菜单
{
SeqList L;
char n;
system("cls");
printf("********************文章编辑**********************\n");
printf("·························\n");
printf("****************输入序号选择功能******************\n");
printf("*****1、由用户输入文章内 *****\n");
printf("*****2、返回上一级菜单 *****\n");
printf("**************************************************\n");
printf("·························\n");
printf("**************************************************\n");
n=getch();
switch(n)
{
case '1':L=Input();
// getch();
system("cls");
break;
case '2':return;
}
}*/
