Thursday, 29 March 2018

To Create A Text File And Write Into It

"Nice One Program"

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{       clrscr();

int a=10;
char ch='a';
double d=10.5;
char cobj[5]="ravi";
ofstream rvobj("rv.txt");
rvobj<<a;
rvobj<<ch;
rvobj<<d;
rvobj<<cobj;
cout<<"\nFile Written";



getch();

}

//File Created will be look like this






And Output:



No comments:

Post a Comment