BEST代写-线上留学生作业代写 & 论文代写专家

成立于2015年的老牌留学生代写品牌-BEST代写提供超过百门冷热门留学学科的作业和论文代写服务。全网BEST原创,高质,准时的留学生代写。

C++代写|ECS36B Homework 4

C++代写|ECS36B Homework 4

这是一个C++单词计算程序代写

Counting words

In this assignment, you will write a program wfreq.cpp that counts the occurrences of words
in a text given on standard input, and prints on output each word encountered in the input with
the number of times it appears. Each word must appear followed by its count on a single line.

Words and their count should appear in output in order of decreasing count. Words having the
same count must appear in lexicographic order.

For simplicity, valid words are defined as strings separated by white space, that consist only of
the letters in [A-Z] and [a-z]. Any word immediately followed or preceded by punctuation (e.g.
“house,” or “away!” must be discarded. Words that include non-letter symbols (e.g. “don’t” must
be discarded. Words and their plural are considered as separate words, i.e. “horse” and “horses”
are counted separately. Words that differ by upper or lower case characters are considered as
separate words, i.e. “You” and “you” are counted separately. White space is defined as the
characters skipped by operator>> when reading strings (this definition includes newline
characters).

Implementation

The STL string class should be used. Judicious use of associative containers and algorithms
can considerably reduce the coding effort. Your program must compile without any warning
within the C++11 definition of the standard (use the option -Wall –std=c++11 with g++).

Testing

Text files are provided together with corresponding reference output obtained e.g. with the
following command:

$ ./wfreq < TheOdyssey.txt > TheOdyssey.out

Submission

Create a tar file hw4.tar containing the file wfreq.cpp only and submit it using Gradescope.

bestdaixie

评论已关闭。