Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

Please help in C++

I can only make changes to the sentences.cpp file, not the ones in grey.

# 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:**
``
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY