How to write a C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming.
C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming. |
//Program which initializes a string variable and outputs the string to the disk file.
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
clrscr();
char a[]="Program which initializes a string variable and outputs the string to the disk file.";
ofstream ofile("disk.txt");
ofile<<a;
ofile.close();
char b;
ifstream ifile("disk.txt");
while(!ifile.eof())
{
ifile.get(b);
cout<<b;
}
getch();
}
This C++ Program which initializes a string variable and outputs the string to the disk file in C++ programming.