C++ EXPERT REQUESTED. I just want take provided input and create output.txt files instead of hardcoding input.txt and output.txt by name in order to create an infinite amount of output.txt files as needed and take infinitely input.txt files as needed. I have implemented most of the code already just need help wrapping things up. I have attached the question and my already implemented code. As you can see I need help with just two things to wrap up the code. Instead of typing fileread.open("input.txt") and filewrite.open("output.txt"), (basically lines 11/12) I want it to instead be taking in its own infinitely as many times input, so instead of "input".txt it might say argv[1] and argv[2] respectively (assuming thats the proper solution for this string text file) as I will be given input files and the code is meant to create its own output.txt files instead infinitely. If any more information is needed please let me know. I was told be live chat to submit this here and a C++ expert can promptly resolve and fix this code for me. Thank you!  This is just for practice and non-graded knowledge question. THE CODE IS WRITTEN BELOW #include #include #include #include using namespace std; int main(int argc, char *argv[]) {   ifstream fileread;   ofstream filewrite;   int count1=0,count2=0,count3=0,count4=0,count5=0;   fileread.open("input.txt");   filewrite.open("output.txt");   if(fileread.is_open()){      string sentence;     while(fileread>> sentence){         for_each(sentence.begin(),sentence.end(),[](char &c)         {             c = ::tolower(c);         });       if(sentence=="a")         count1++;       else if(sentence=="an")         count2++;       else if(sentence=="the")         count3++;     else if(sentence=="it")         count4++;     else if(sentence=="there")         count5++;                      }              filewrite<<"A: "<

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

C++ EXPERT REQUESTED. I just want take provided input and create output.txt files instead of hardcoding input.txt and output.txt by name in order to create an infinite amount of output.txt files as needed and take infinitely input.txt files as needed. I have implemented most of the code already just need help wrapping things up. I have attached the question and my already implemented code. As you can see I need help with just two things to wrap up the code. Instead of typing fileread.open("input.txt") and filewrite.open("output.txt"), (basically lines 11/12) I want it to instead be taking in its own infinitely as many times input, so instead of "input".txt it might say argv[1] and argv[2] respectively (assuming thats the proper solution for this string text file) as I will be given input files and the code is meant to create its own output.txt files instead infinitely.
If any more information is needed please let me know. I was told be live chat to submit this here and a C++ expert can promptly resolve and fix this code for me. Thank you!  This is just for practice and non-graded knowledge question. THE CODE IS WRITTEN BELOW

#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>

using namespace std;
int main(int argc, char *argv[]) {
  ifstream fileread;
  ofstream filewrite;
  int count1=0,count2=0,count3=0,count4=0,count5=0;
  fileread.open("input.txt");
  filewrite.open("output.txt");
  if(fileread.is_open()){
     string sentence;
    while(fileread>> sentence){
        for_each(sentence.begin(),sentence.end(),[](char &c)
        {
            c = ::tolower(c);
        });
      if(sentence=="a")
        count1++;
      else if(sentence=="an")
        count2++;
      else if(sentence=="the")
        count3++;
    else if(sentence=="it")
        count4++;
    else if(sentence=="there")
        count5++;
      
     
        }
        
    filewrite<<"A: "<<count1<<endl<<"An: "<<count2<<endl<<"The: "<<count3<<endl<<"It: "<<count4<<endl<<"There: "<<count5;
         
       
       
      
      }
  return 0;
     }
     


  

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
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