Re: [問題] c++讀檔 不知道怎麼判斷文章已結束
※ 引述《kuro44776》之銘言:
: http://rafb.net/p/jG7ks624.html
: 以下是文章的一小段
: I have known Mary Lin for five years.
: She is my best friend. Our relation is not like the friend.
: We will make a fun and still share together a little more happy and unhappy things.
: 題目要求要讀出單字數目 字元數目 還要在最後記算每個字母的出現次數
class Counter {
public:
/// 計算單字
void addWord( const string & );
/// 單字數目
int getWordCount() const;
/// 字元數目
int getCharCount() const;
/// 字母次數
vector<int> getABCount() const;
};
string word;
Counter counter;
while( cin >> word ) {
counter.addWord( word );
}
cout << counter.getWordCount() << endl;
cout << counter.getCharCount() << endl;
cout << counter.getABCount() << endl;
----
有電鋸為什麼要用手鋸?XD
--
自High筆記(半荒廢)
http://legnaleurc.blogspot.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.146.203.213
推
03/25 01:00, , 1F
03/25 01:00, 1F
→
03/25 01:01, , 2F
03/25 01:01, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章