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()) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.