Topic: Files and Streams
Codes discussed will be posted here. Write your conclusion on the File stream discussion.
Filename: "Ch5_AccountBalance.cpp"
Given problem and code: Please use the link below
-->>https://drive.google.com/file/d/1tDK28GtTpqbQ_sSKVkpdTQFJQz3gtlcB/view?usp=sharing
*Note: Need the proper codes
*Note need proper codes and conclusion on how its done and about the results. And please give the proper solution and explanation.
Note: Place your conclusion on why did it turn out like that and give your reasons why the results turned like that, one paragraph will do for the explanation and conclusion.
#include <fstream>
#include <iostream>
using namespace std;
int main ()
{
char data[100];
// opening a file in write mode.
ofstream myfile;
myfile.open("E:\\message.txt");
cout << "Writing to the file" << endl;
cout << "Enter your name: ";
cin.getline(data, 100);
myfile << data << endl;
cout << "Enter your age: "; cin >> data;
cin.ignore();
myfile << data << endl;
// close the opened file.
myfile.close();
// opening a file in read mode.
ifstream infile;
infile.open("E:\\message.txt");
cout << "Reading from a file" << endl; infile >> data;
cout << data << endl; infile >> data;
cout << data << endl;
infile.close();
return 0;
}
Comments
Dear ASAP , if you have serious assignment that requires large amount
of work and hence cannot be done for free you can submit it as assignment and our
experts will surely assist you.
I said give me a conclusion and a solution why is there another code which is not related to the code I sent!!!
Leave a comment