This is a C programing assignment Please help with both the

This is a C++ programing assignment. Please help with both the programs.

Hint for both problems: the << and >> operators are type-aware; that is, if you have an input file stream object called inf, then this

char ch;
inf >> ch;

will cause one byte to be read from the file associated with inf into the variable ch.

Problem 1. Your program will take three filenames from the command line. The file named by the second filename will be \"concatenated\" to the end of the file named by the first filename, and the result written to the file named by the third filename. Choose your own files for testing. The graders will choose theirs, too.

Problem 2. Your program will take a filename from the command line and count the vowels contained therein. For the purposes of this problem, the vowels are a, e, i, o, u, and their uppercase equivalents. Choose your own files for testing. The graders will choose theirs, too.

Hint: if you declare a string

string vowels = \"aAeEiIoOuU\";

then the function call vowels.find(ch) will return a non-null pointer if ch is a vowel.

Solution

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
   string s1,s2,s3;

   cout<<\"Enter the First file name:\";
   getline(cin,s1);
   //ifstream infile1(s1);

   cout<<\"Enter the Second file name:\";
   getline(cin,s2);
   //ifstream infile2(s2);

   cout<<\"Enter the Third file name:\";
   getline(cin,s3);
   ofstream output;
output.open(s3.c_str());

output<<s1+s2;
   //cout<<s3<<endl;
output.close();

   return 0;
}

This is a C++ programing assignment. Please help with both the programs. Hint for both problems: the << and >> operators are type-aware; that is, if

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site