Part 2: Simple string operations in C++
Background: Similar to almost all programming languages, C++ provides a standard set of string
functions that can be used to perform standard string operations.
Exercise: This exercise expects you to develop a simple program that performs the following string:
1. Read a line of input (using std::getline method) from the user after prompting for input (see sample
output below for message details).
2. The program must display the following information about the line entered by the user (see sample
output for message details):
1. The number of words.
2. The largest word.
(https://miamioh.instructure.com/courses/129645/files/16945822/download?download_frd=1) has a
template with comments to help get you started with the lab.
Note: You may assume that there is only one blank space between words (user will input at least 1
word) and there are no leading or trailing blanks.
Hint: Carefully consider the parameters of substr and consider what you just learned regarding the find
methods defined on std::string
Style checking C++ programs
In this course, we will be adhering to the CSE programming style conventions
(http://miamioh.edu/cec/academics/departments/cse/academics/programming-style/index.html) ). The style
conventions will be checked and enforced using the cpplint tool (a slightly modified version of Google’s
User inputs in two different runs of the program are shown in red color in the sample outputs below:
Total Points: 26
Some Rubric (1)
Criteria Ratings Pts
[vendomcg@Dagobah lab2]$ ./vendomcg_lab2
Enter a line: i will go to spring ice
Number of words: 6
Largest word: spring
[vendomcg@Dagobah lab]$ ./vendomcg_lab2
Enter a line: checking 1 two 3
Number of words: 4
Largest word: checking
Due: Wednesday, September 2nd @ 11:59PM
Follows Style Guide 2 pts
Uses getline to get input from user 4 pts
Follows specification to get user input 4 pts
Follows specification on displaying results 4 pts
Correctly identifies the largest word 6 pts
Correctly identifies word count 6 pts