Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is my code so far. void processJunk ( ); int main ( ) { ifstream junk; ofst

ID: 3617725 • Letter: H

Question

Here is my code so far.

void processJunk ( );

int main ( )
{
    ifstream junk;
    ofstream letter;
char next;

    junk.open("junk.txt");
if (junk.fail())
{
  cout << "Input junk.txt file open failed.";
  exit(1);
}
    letter.open("letter.txt");
if (letter.fail())
{
  cout << "Output letter.txt file openfailed.";
  exit(1);
}
junk.get(next);
while(!(junk.eof()))
{
  if('#' == next)
  {
   processSequence(junk,letter);
  }
  else
  {
   letter << next;
  }
  junk.get(next);
}
junk.close();
letter.close();

}
void processSequence(ifstream& junk, ofstream& letter)
{
char next;
junk.get(next);
if ('N' == next)
{
  junk.get(next);
  if('#' == next)
  {
   // Get the name to replace #N# with and
   // send it to the output stream.
  }
  else
  {
   letter << "#N" << next;
  }

}
else
{
  letter << '#' << next;
}
}

Explanation / Answer

please rate - thanks #include #include #include #include using namespace std; void processSequence(ifstream&, ofstream& ); int main ( ) {     ifstream junk;     ofstream letter; char next; int type;     junk.open("junk.txt"); if (junk.fail()) { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote