
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
Help
C++
![Sample Testcase 0:
Input:
C++
F1.txt
1
Output:
Sample Testcase 1:
Input:
C++
F1.txt
Output:
1
Sample Testcase 2:
Input:
C++
F1.txt
2
Output:
Invalid
1.
#include <iostream>
2
#include <fstream>
using namespace std;
4
int main()
{
char filename [20];// Use
this variable to read the name
7
8
of the file that contains the
text.
int mode;
10
string word;
11
cin>>word>>filename>>mode;
12
13
14](https://content.bartleby.com/qna-images/question/a936b18e-20fb-4c55-9164-a34fa27f17dd/b9b6e6d0-5e0e-457b-a186-473f33d6a5f8/ao7krkf_thumbnail.jpeg)
Transcribed Image Text:Sample Testcase 0:
Input:
C++
F1.txt
1
Output:
Sample Testcase 1:
Input:
C++
F1.txt
Output:
1
Sample Testcase 2:
Input:
C++
F1.txt
2
Output:
Invalid
1.
#include <iostream>
2
#include <fstream>
using namespace std;
4
int main()
{
char filename [20];// Use
this variable to read the name
7
8
of the file that contains the
text.
int mode;
10
string word;
11
cin>>word>>filename>>mode;
12
13
14

Transcribed Image Text:12:29 A 1 o
Write a program that finds the number of times a
specific word appears in a text file. The program
should accept the following inputs from the user:
• The word that you are looking for. The word
length should be 3 or more otherwise the
program should print Too short. The word
should not have a space character.
• The name of the file that contains the text
• The type of the search
O for case senstive search
o 1 for case insensitive search
o For any other input the program
should output Invalid
o Note that the word should be
preceded and succeeded by spaces.
Note: Assume for all sample test cases that
thecontent of F1.txt is:
C++ is a general-purpose programming language
created by Bjarne Stroustrup as an extension of
the C programming language, or "C with Classes".
The language has expanded significantly over
time, and modern C++ now has object-oriented,
generic, and functional features in addition to
facilities for low-level memory manipulation. It is
almost always implemented as a compiled
language, and many vendors provide c++
compilers, including the Free Software
Foundation, LLVM, Microsoft, Intel, Oracle, and
IBM, so it is available on many platforms.
1/0
Program Input:
• A single line that takes in the word that
you are searching for
• A single line that takes in the name of
the file that contains the text
• A single line that takes in the type of
the search
Program Output:
• A single line that outputs either the
number of occurences of the word in
the textfile.
Expert Solution

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

Knowledge Booster
Similar questions
- Complete the function given below: int square (int x) { // Return square of x } C++ language.arrow_forwardHi, I am having difficulty finding words to better explain these questions for my homework. 1. What is a reference in C++? 2. What is a pointer in C++? 3. What is the difference between a pointer and a reference in C++?arrow_forwardPlease us c++ to make the code thank you very much!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