91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 880KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-06
  • 語言: C/C++
  • 標簽: 文章編輯??

資源簡介

核心算法采用比較先進的kmp算法,代碼完全出自自己的努力。你要是感興趣,就請給點兒辛苦費吧! 另外,補充一點兒,功能也比較全面

資源截圖

代碼片段和文件信息

#include
#include
#include
#include
#define?N?100
int?nextval[N];//存儲nextval的值
int?place[N];
int?OverlayValue[N];
int?num[4]={0};//num[0]代表空格?num[1]代表字母?num[2]代表數字?num[3]代表單詞個數

typedef?struct?text//
{
char?sline[90];
struct?text?*next;
}TEXT;

bool?isAlphabet(char?&t);//如果字符是字母就返回真
bool?isDigit(char?&t);//如果是數字就返回真
bool?isSpace(char?&t);//是空格就返回真
int?wordnum(char?*t);//統計某一行的單詞數量
void?GetNextval(char?const?*ptr?int?plenint?*nextval);//求nextval
int?kmp1(char?const?*scrint?slenchar?const?*ptrint?plenint?const?*nextvalint?pos);//求字符串中模式串的個數
int?search(char?const?*scrchar?const?*ptr);///在主串中找到字串的位置,沒有返回零
bool?delet(char?const?*scrchar?const?*ptr);//刪除指定的字串。
bool?readtext(TEXT?*headint?n);//讀入文章
void?release(TEXT?*head);//釋放節點
void?OutputText(TEXT?*head);//在屏幕上輸出文字
int?countword(TEXT?*headchar?const?*ptr);//統計文章中某個單詞的個數
void?countother(TEXT?*head);//統計文章中的空格,字母,數字和單詞的個數
int?deltext(TEXT?*headchar?const?*ptrint?*OverlayValue);//刪除文章中的指定單詞
void?OverlayFun(char?const?*ptrint?*OverlayValue);//覆蓋函數

int?main()
{
TEXT?*head;
head=(TEXT?*)malloc(sizeof(TEXT));
if(head==NULL)
{
printf(“內存分配失敗\n“);
return?-1;
}
printf(“請輸入你要寫入的文章的行數:?“);
int?n;
scanf(“%d“&n);
getchar();
readtext(headn);

printf(“請輸入你要查找的單詞:?“);
char?t[80];
scanf(“%s“t);
GetNextval(tstrlen(t)nextval);
int?thewordnum=countword(headt);

countother(head);
printf(“你查找的單詞在文章中的個數是:%d\n“thewordnum);
printf(“文章中空格的個數:%d\n字母的個數:%d\n數字的個數:%d\n單詞的個數:%d\n“num[0]num[1]num[2]num[3]);

char?inputtag=‘Y‘;
while(inputtag==‘y‘?||inputtag?==‘Y‘)
{
????printf(“請輸入你要刪除的單詞:“);
char?thedel[80];
scanf(“%s“thedel);
//if(!=0?)
// {
????deltext(headthedelOverlayValue);
printf(“輸出刪除后的文章\n“);
????OutputText(head);
printf(“繼續刪除單詞請按y?:??“);
char?x;
???????? scanf(“?%c“&x);
inputtag=x;
// }
// else
// {
// printf(“文章中沒有你要刪除的單詞!\n重新刪除請按y“);
// char?x;
// scanf(“?%c“&x);
// inputtag=x;
// }

}
release(head);
return?0;
}
bool?isAlphabet(char?&t)//如果字符是字母就返回真
{
if(t>=‘a‘&&t<=‘z‘?||?t>=‘A‘&&t<=‘Z‘)
return?true;
else?return?false;
}
bool?isDigit(char?&t)//如果是數字就返回真
{
if(t>=‘0‘?&&?t<=‘9‘)
return?true;
else?return?false;
}
bool?isSpace(char?&t)//是空格就返回真
{
if(t==‘?‘)
return?true;
else?return?false;
}
int?wordnum(char?*t)//統計字符串中的單詞個數
{
int?i;
bool?tag=false;
bool?is=false;
int?wordnum=0;
for(i=0;i {
if(t[i]==‘?‘?&&?!tag)//忽略字符串開頭的空格字符
continue;
else?tag=true;

if(t[i]>=‘a‘?&&?t[i]<=‘z‘?||?t[i]>=‘A‘?&&?t[i]<=‘Z‘)
{
is=true;
}
else?if((t[i]==‘?‘?||?t[i]==‘‘?||?t[i]==‘.‘?||?t[i]==‘\n‘||?t[i]==‘\0‘?||?t[i]==‘?‘?||?t[i]==‘!‘)??&&?is)//is為true代表在遇到空格或其他分隔符之前遇到字母
{
wordnum++;is=false;
}
}
if(is)wordnum++;
return?wordnum;
}

void?GetNextval(char?const?*ptr?int?plenint?*nextval)//求nextval
{
int?i=0;
nextval[0]=-1;

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????725971??2013-07-17?10:42??任師鋒-201107063-文章編輯\任師鋒-201107063-文章編輯.docx

?????文件?????188463??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\Debug\text.exe

?????文件?????194632??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\Debug\text.ilk

?????文件??????17897??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\Debug\text.obj

?????文件?????216072??2013-07-09?15:40??任師鋒-201107063-文章編輯\文章編輯\Debug\text.pch

?????文件?????451584??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\Debug\text.pdb

?????文件??????41984??2013-07-17?10:12??任師鋒-201107063-文章編輯\文章編輯\Debug\vc60.idb

?????文件??????53248??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\Debug\vc60.pdb

?????文件???????6599??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\text.cpp

?????文件???????3377??2013-07-17?08:15??任師鋒-201107063-文章編輯\文章編輯\text.dsp

?????文件????????533??2013-07-17?10:46??任師鋒-201107063-文章編輯\文章編輯\text.dsw

?????文件??????41984??2013-07-17?10:46??任師鋒-201107063-文章編輯\文章編輯\text.ncb

?????文件??????48640??2013-07-17?10:46??任師鋒-201107063-文章編輯\文章編輯\text.opt

?????文件???????1259??2013-07-17?10:10??任師鋒-201107063-文章編輯\文章編輯\text.plg

?????文件?????????77??2013-07-17?20:47??任師鋒-201107063-文章編輯\說明.txt

?????目錄??????????0??2013-07-17?10:48??任師鋒-201107063-文章編輯\文章編輯\Debug

?????目錄??????????0??2013-07-17?10:48??任師鋒-201107063-文章編輯\文章編輯

?????目錄??????????0??2013-07-17?10:53??任師鋒-201107063-文章編輯

-----------?---------??----------?-----??----

??????????????1992320????????????????????18


評論

共有 條評論