Question: Program 8 . 2 #include #include #include / / needed for exit ( ) using namespace std; int main ( ) { what does this
Program
#include
#include
#include needed for exit
using namespace std;
int main
what does this code mean
ifstream inFile;
ofstream outFile;
inFile.openpricesdat"; attempt to open the file for input
char response;
if inFile.fail if it doesn't fail, the file exists
cout "A file by the name prices.dat exists.
Do you want to continue and overwrite it
with the new data y or n: ;
cin response;
if tolowerresponsen
cout "The existing file will not be overwritten." endl;
exit; terminate program execution
outFile.openpricesdat"; now open the file for writing
if inFilefail check for a successful open
cout
The file was not successfully opened"
endl;
exit;
cout "The file has been successfully opened for output."
endl;
statements to write to the file would be placed here
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
