Question #332859

Write a program to read the content of a file and copy its content to another file after converting all the capital case letters in the file to small case letters. 


Expert's answer






Notice before will run program please don't forget create file


#include <iostream>
#include <fstream>
#include  <string>
using namespace std;
int main() {
  cout<<"Please enter file name and type(.txt...):";
  string fnm;
  cin>>fnm;
  ifstream inp(fnm);
  if(!inp)//
  {
    cout<<"File doesnt exist!!\n";
    return 0;
  }
  string copyName="CopyFile.txt";//There is name of copy file
  string line;//each line read
  ofstream of(copyName,ios::trunc);
  while(getline(inp,line))
    {
      //capital cae letter to small case letter
      for(unsigned i=0;i<line.size();i++)
        line[i]=tolower(line[i]);
      of<<line<<"\n";
    }
  inp.close();
  of.close();
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS