-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArticle.h
More file actions
50 lines (35 loc) · 915 Bytes
/
Article.h
File metadata and controls
50 lines (35 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef ARTICLE_H
#define ARTICLE_H
#include <string>
#include <vector>
using namespace std;
const int MAX_LINE_LENGTH = 80;
// 线性表存储结构 - 存储文章
class Article {
private:
vector<string> lines; // 使用线性表存储每行文字
public:
// 输入文章
void inputArticle();
// 显示文章内容
void displayArticle() const;
// 统计英文字母数
int countLetters() const;
// 统计数字个数
int countDigits() const;
// 统计空格个数
int countSpaces() const;
// 统计文章总字数(所有字符)
int countTotalChars() const;
// 显示统计结果
void showStatistics() const;
// 获取整篇文章为一个字符串
string getFullText() const;
// 统计某一字符串出现的次数
int countSubstring(const string& substr) const;
// 删除某一子串,并将后面的字符前移
void deleteSubstring(const string& substr);
// 检查文章是否为空
bool isEmpty() const;
};
#endif