Complete the words program which opens the files specified on the command line and prints the file name and how many words each file contains.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Complete the words program which opens the files specified on the command line and prints the file
name and how many words each file contains.
$ words a.txt b.txt c.txt
a.txt 32
b.txt 151
c.txt does not exist
words.cpp
#include <iostream>
#include <fstream>
1
#include <sstream>
using namespace std;
int main(int argc, char* argv[])
{
8
10
11
}
a1.txt
Alice was beginning to get very tired of sitting by her sister on the
bank, and of having nothing to do: once or twice she had peeped into the
3
1
book her sister was reading, but it had no pictures or conversations in
a2.txt
book her sister was reading, but it had no pictures or conversations in
it, 'and what is the use of a book,' thought Alice 'without pictures or
1.
conversation?'
а3.txt
So she was considering in her own mind (as well as she could, for the
hot day made her feel very sleepy and stupid), whether the pleasure
3 of making a daisy-chain would be worth the trouble of getting up and
1.
a4.txt
of making a daisy-chain would be worth the trouble of getting up and
picking the daisies, when suddenly a White Rabbit with pink eyes ran
3
1
close by her.
a5.txt
There was nothing so VERY remarkable in that; nor did Alice think it so
VERY much out of the way to hear the Rabbit say to itself, 'Oh dear!
3 Oh dear! I shall be late!' (when she thought it over afterwards, it
1
а6.txt
1
Oh dear! I shall be late!' (when she thought it over afterwards, it
2
occurred to her that she ought to have wondered at this, but at the time
3
it all seemed quite natural); but when the Rabbit actually T0OK A WATCH
4
OUT OF ITS WAISTCOAT-POCKET, and looked at it, and then hurried on,
Transcribed Image Text:Complete the words program which opens the files specified on the command line and prints the file name and how many words each file contains. $ words a.txt b.txt c.txt a.txt 32 b.txt 151 c.txt does not exist words.cpp #include <iostream> #include <fstream> 1 #include <sstream> using namespace std; int main(int argc, char* argv[]) { 8 10 11 } a1.txt Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the 3 1 book her sister was reading, but it had no pictures or conversations in a2.txt book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' thought Alice 'without pictures or 1. conversation?' а3.txt So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure 3 of making a daisy-chain would be worth the trouble of getting up and 1. a4.txt of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran 3 1 close by her. a5.txt There was nothing so VERY remarkable in that; nor did Alice think it so VERY much out of the way to hear the Rabbit say to itself, 'Oh dear! 3 Oh dear! I shall be late!' (when she thought it over afterwards, it 1 а6.txt 1 Oh dear! I shall be late!' (when she thought it over afterwards, it 2 occurred to her that she ought to have wondered at this, but at the time 3 it all seemed quite natural); but when the Rabbit actually T0OK A WATCH 4 OUT OF ITS WAISTCOAT-POCKET, and looked at it, and then hurried on,
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY