PROGRAM TO CREATE A TEXT FILE USING A STRING VARIABLE

#include<iostream.h>
#include<fstream.h>
#include<ctype.h>
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char str[80];
ofstream fout(“testfile.txt”);
char choice=’y’;
do
{
cout<<“Enter the string to be written onto the file\n: “;
gets(str);
fout<<str<<endl;
cout<<“Want to add more text(y/n) “;
cin>>choice;
}while((choice==’Y’)||(choice==’y’));
fout.close();
}

Comments

Popular Posts