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

  • 大小: 16KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-28
  • 語言: C/C++
  • 標(biāo)簽: C語言??文章編輯??

資源簡介

本程序是以學(xué)校數(shù)據(jù)結(jié)構(gòu)與算法課程設(shè)計(jì)要求為背景,利用了C語言、數(shù)據(jù)結(jié)構(gòu)知識和VC++6.0開發(fā)平臺,開發(fā)的文章編輯器。源程序中本人為代碼加上了明確的詳細(xì)注釋,適合后來者參考和提供思路。

資源截圖

代碼片段和文件信息

#include
#include
#include
#include
#define?N?80//文章行數(shù)
typedef?struct?line
{
char?str[N];??????//存儲該行的內(nèi)容?
int?num;?????????????????//用來記錄行號
struct?line?*prior;??????//用來指向前一行
struct?line?*next;???????//用來指向下一行
?}LINE;
LINE?*start;??????????//指向線性表的第一行
LINE?*last;???????????//指向線性表的最后一行

int?Choice();?
int?ij;?
int?ch=0;
void?title()
{
printf(“?____________________________________________________\n\n“);
printf(“?****?????????????歡迎使用文章編輯系統(tǒng)???????????****??\n“);
printf(“?****?????????作者:???學(xué)號:??????****??\n“);
printf(“?____________________________________________________??\n“);
}
int?menu()
{
title();
printf(“|???????????????????【?功能菜單?】??????????????????|\n“);
printf(“|?????????????????????0.退出系統(tǒng)????????????????????|\n“);
printf(“|?????????????????????1.輸入文章????????????????????|\n“);
printf(“|?????????????????????2.輸出文章????????????????????|\n“);
printf(“|?????????????????????3.刪除字符????????????????????|\n“);
printf(“|?????????????????????4.添加字符????????????????????|\n“);
printf(“|?????????????????????5.統(tǒng)計(jì)數(shù)目????????????????????|\n“);
printf(“|?????????????????????6.存儲文章????????????????????|\n“);
printf(“|?????????????????????7.打開文章????????????????????|\n“);
printf(“-----------------------------------------------------\n“);
printf(“???????????????????請輸入一個(gè)數(shù)<0-7>:“);
}
void?Output()
{
LINE?*p?=?start;
while(p?!=?last)?//當(dāng)p所指向的不是最后一行時(shí),循環(huán)輸出?
{
printf(“\n\n第%d行|%s“p->nump->str);?//輸出行號和字符串?
p?=?p->next;//p指向下一行?
}
printf(“\n\n第%d行|%s\n“l(fā)ast->numlast->str);?//當(dāng)p所指向最后一行時(shí),輸出最后一行內(nèi)容?
printf(“\n“);
}
void?Input()
{
LINE?*info*temp;//行指針,info指向當(dāng)前行,temp指向info的前驅(qū)行?
char?ch;??//ch用于記錄輸入的字符串?
int?linenumi;//行計(jì)數(shù)器i為行字符數(shù)組下標(biāo)?
FILE?*fp;??//文件指針?
temp?=?NULL;?//將temp置空??????????????????????
start?=?(LINE*)malloc(sizeof(LINE));?//生成一行的結(jié)點(diǎn)空間?
info?=?start;//指向線性表的第一行
linenum?=?1;?//行號初值為1?
printf(“請輸入文章內(nèi)容[每行不得超過80個(gè)字符(以字符‘#‘結(jié)束)]:\n“);?
while((ch?=?getchar())!=‘#‘)?//當(dāng)接收到字符不為‘#‘?
{
i?=?0;//i為行字符數(shù)組下標(biāo)初值為0?
info->str[i]?=?ch;//將ch即接收到的字符存儲到該行中?
i++;//下標(biāo)加1?
while((ch?=?getchar())!=‘\n‘)?//從文件中讀到一行字符到線性表中?
{ ??????//一行中有多少字符就循環(huán)多少次?
info->str[i]?=?ch;
i++;
}
info->str[i]?=‘\0‘;???
info->num?=?linenum++;??//行號存儲在線性表中后加一?
info->next?=?(LINE*)malloc(sizeof(LINE));//為下一行生成一行的結(jié)點(diǎn)空間?
if?(i>=80)??//0~79個(gè)字符?
{
printf(“每行最多輸出80個(gè)字符!\n“);?
printf(“請重新輸入文章!\n“);
Sleep(5000);??//休眠5秒?
system(“cls“);
title();
Input();
}
info->prior?=?temp;
temp?=?info;
info?=?info->next;
? }?
? temp->next?=?NULL;
? last?=?temp;
? free(info);
? start->prior?=?NULL;
}

int?CountAll()
{
int?English=0;//英文字母數(shù)目?
int?Blank=0;//空格數(shù)目?
int?Number=0;//數(shù)字?jǐn)?shù)目
int?All=0;//所有文字?jǐn)?shù)目
int?i=0;
LINE?*p?=?start;
//首先輸出原文章
printf(“\n|>>>????????????????【原文章】???????????????<<<|\n“);
while(p?!=?last)?//當(dāng)p所指向的不是最后一行時(shí),循環(huán)輸出?
{
printf(“\n\n第%d行|%s“p->nump->str);?//輸出行號和字符串?
wh

評論

共有 條評論

相關(guān)資源