二、详细设计(实验过程)
1、数据结构定义
2、全局变量定义
3、函数说明
(1)CreatWord() 文本创建函数
(2)PrintWord() 文章显示函数
(3)CountWord() 文章内容统计函数
void CountWord()
{
LinkList *temp;
char ch;
int i,j,t;
int WORD=0,word=0,space=0,num=0,sum=0;
temp=head->next;
for(j=0;j<=NUM;j++)
{
for(i=0;(i<80)&&(temp->data[i])!='#';i++)
{
ch=temp->data[i];
if((ch>='A')&&(ch<='Z'))
WORD++;
else if((ch>='a')&&(ch<='z'))
word++;
else if((ch>='0')&&(ch<='9'))
num++;
else if(ch==' ')
space++;
}
sum=WORD+word+num;
}
while(1)
{
printf("\n");
printf("\n");
printf("\n");
printf("\t\t************************************
printf("\t\t**** 文章内容统计子菜单
printf("\t\t************************************
printf("\t\t**** 文章中 字母 的个数:
printf("\t\t**** 文章中 数字 的个数:
printf("\t\t**** 文章中 空格 的个数:
printf("\t\t**** 文章中 所有字 的个数: %
printf("\t\t**** 1、退出返回主菜单
printf("\t\t**** 2、直接退出本系统
printf("\t\t************************************
printf("\t\t请选择:");
scanf("%d",&t);
if(t==1){system("cls");
break;}
else if(t==2)exit(0);
else
{
printf("\t\t 对不起,无此功能!请回车重新选择!...\n");
printf("\t\t");
fflush(stdin);
getchar();
}
}
}
利用循环对链表中信息进行匹配判断,将大写字母数、小写字母数、空格数、数字数和总字数统计出来:for(
{
for(i=0;(i<80)&&(temp->data[i])!='#';i++)
{
ch=temp->data[i];
if((ch>='A')&&(ch<='Z'))
WORD++;
else if((ch>='a')&&(ch<='z'))
word++;
else if((ch>='0')&&(ch<='9'))
num++;
else if(ch==' ')
space++;
}
sum=WORD+word+num;
}
(4)SearchWord() 文章内容查找函数
(5)DeleteWord() 文章内容删除函数
(6)Bmenu() 文章内容处理菜单函数
(7)AboutWord() 相关性息
void AboutWord()
{printf("\n\n\n\n\n\n\n\n");
printf("\t**********************************
printf("\t**** 本系统由 chevis 制作 部分功能则是仿照其他程序 能力有
printf("\t**** 谢谢使用!
printf("\t****************************
printf("\n");
}
(8)menu() 主菜单
(9)main() 主函数
三、上机调试
四、测试结果及分析