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

I am receiving a blank screen when using the following program on my C++ program

ID: 3646084 • Letter: I

Question

I am receiving a blank screen when using the following program on my C++ program. Please help...


//This program reads characters from a file using the get and ignore functions.
//The program reads strings from a file using the getline function and the
//extraction operation (>>) and writes the output to a file

#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>

using namespace std;

int main ()
{
ifstream inFile;
ofstream outFile;
char ch1;
char ch2;
string str1;
string str2;
string str3;

inFile.open("f:\input.txt"); //CHANGE PATH FOR YOUR STORAGE DEVICE
outFile.open("f:\output.txt"); //CHANGE PATH FOR YOUR STORAGE DEVICE

inFile >> ch1;

//Use the get function to store the first character in the file into
//the character variable ch1
cin.get(ch1);

//Write the character to the output file
outFile << "T" << ch1 << endl;

//Use the ignore function to skip the next 10 characters in the file
cin.ignore(10,' ');

inFile >> ch2;

//Use the get function to store the character where the reading marker
//is now positioned into the variable ch2
cin.get(ch2);

//Write this character to the output file
outFile << "r" << ch2;

//Use the ignore function to skip to the end of the line.
cin.ignore(100,' ');

//Use the getline function to read and store the second line of data into
//the variable str1
getline(cin, str1);

//Write the contents of str1 to the output file
outFile << " to " << str1 << endl;

//The reading marker is positioned at the first character of the third
//line of the file. Use the extraction operator (>>) to store the word
//"consistent" into str2 and to store the word "with" into str3
cout << "consistent" << str2 << "with" << str3;

//Write the contents of str2 and str3 to the output file
outFile << str2 << str3;

inFile.close();
outFile.close();

_getch();
return 0;
}

Explanation / Answer

put these header files , Answer Details #include #include #include #include
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