
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Please help in C++
I can only make changes to the sentences.cpp file, not the ones in grey.

Transcribed Image Text:# Transcription and Explanation for Educational Website
## Code Explanation
### Code Segment: `sentences.cpp`
This C++ program prompts the user for an input file name and reads all the words from the specified file. It outputs the words to a file named `sentences.txt`. Key features of the program include starting a new line whenever a word ends with a period, question mark, or exclamation mark, including when followed by a quotation mark. Otherwise, words are separated by spaces.
**Code Breakdown:**
```cpp
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main() {
cout << "Input file: " << endl;
string input_file_name;
cin >> input_file_name;
// Additional code logic would be here.
return 0;
}
```
- **Libraries Included:**
- `<iostream>`: For input and output stream operations.
- `<string>`: For using the `string` data type.
- `<fstream>`: For file stream operations.
- **Variables:**
- `input_file_name`: A string variable to store the name of the input file.
- **User Prompt:**
- The program prompts the user to enter the input file name.
### Text Files Content
#### `in1.txt`
This file contains part of a narrative with dialogue. The text involves a conversation where Holmes indicates he must leave, and Watson expresses a willingness to accompany him.
**Content:**
```
"I am afraid, Watson, that I shall have to go," said Holmes, as we sat down together to our breakfast one morning.
"Go! Where to?"
"To Dartmoor; to King's Pyland."
I was not surprised. Indeed, my only wonder was that he had not already been mixed up in this extraordinary case, which was the one topic of conversation through the length and breadth of England.
"I should be most happy to go down with you if I should not be in the way," said I.
"My dear Watson, you would confer a great favor upon me by coming. And I think that your time will not be misspent, for there are points about the case which promise to make it an absolutely unique one.
```
#### `in2.txt`
This file presents a reflection on happy and unhappy families, quoting the idea that each unhappy family faces its own unique issues. Additionally, it hints at domestic discord involving intrigue.
**Content:**
``
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- you will develop a string-reversing c++ program using functions. You will need to create a function str_rev() that takes a parameter of string type as the input and returns the reversed string.arrow_forwardC++ Here is the original question for what it is worth. Please do not give me an answer you found on Chegg. I have one of those accounts too. Please read carefully, I have submitted this question several times and no one could follow directtions. I have my code doing what is asked of the problem with the exception of displaying the last_name, first_name A teacher is requiring her students to line up in alphabetical order, according to their first names..For example, in one class Chapel, Christine would be at the front and Uhura, Nyota would be last. The program will get the names from a file using getline since the file name includes spaces. The names should be read in until there is no more data to read. The program should prompt the user for the file name and read the data from the file. Note that these names might include spaces; handle your input accordingly. The expected output is two names; do not show the entire file. Do not use arrays or sorting for this problem. Here is my…arrow_forwardPls make a code for this on c++ and make sure it is 100% correct. i wastred 4 questoins on this and they all are not correct. Write the code as described in the questions below. Submit your code electronically in the box at the bottom. You may only use Java, C# or C++. The economy is defined using a 2-dimensional data structure: A “payday” will be considered to be any region of $ values where all cells in the region are connected either vertically or horizontally. For example, the following illustrates a matrix with 5 rows and 8 columns containing three objects. $’s and P are used in the diagram to represent the two types of values: PPPP$PPPPPP$$PPPPP$$PPP$PP$PPPP$P$PPP$$$ a) Write a program to read in the data from the text file and store it into a data structure. Your program should output it to the screen after it has read in the file. (If you can’t get this to work hard-code the above example and continue to part b). Here is a sample text file (containing the above data):…arrow_forward
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY