Untitled
unknown
plain_text
a year ago
545 B
6
Indexable
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ofstream ofile;
ifstream ifile;
char data[100];
ofile << "Welcome in c++ . Regards: CSE Department, GITS"<< endl;
cout << "\nData written to file"<< endl;
ofile.close();
//create a text file before executing.
ifile.open ("text.txt");
cout<<"\nData read from the file:";
while (!ifile.eof())
{
ifile.getline (data,100);
cout<<data<<endl;
}
ifile.close();
return 0;
}Editor is loading...
Leave a Comment