Write a program to read the content of a file and: (1) identify how many words a
ID: 3621763 • Letter: W
Question
Write a program to read the content of a file and:(1) identify how many words are in the file.
(2) print the first and the last words within the file.
A Word is defined as a group of adjacent characters separated by one or more blank space(s) from another word. The program should ask the user for the name of the input file.
Submit a copy of your input file with program and its outputs
Explanation / Answer
Hope this helps. Let me know if you have any questions. Please rate. :) =========================== PROGRAM: =========================== #include #include #include using namespace std; int main() { ifstream inFile; string fileName; string input; int count = 0; cout > fileName; // Note that this will not work for file names with spaces. If spaces are required in the filename, use getline(cin, fileName). inFile.open(fileName); if (!inFile.is_open()) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.