看板 C_and_CPP 關於我們 聯絡資訊
※ 引述《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
kuro44776:題目要求你用手鋸 此題以解決 03/25 01:00
kuro44776:我把str.length()當成while的判斷條件就行了... 03/25 01:01