#include<fstream.h>
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int id;
float salary;
ofstream fout;
fout.open("29AP1.txt",ios::app);
char c='y';
while(c=='y' || c=='Y')
{
cout<<"Enter Your ID"<<endl;
cin>>id;
cout<<"Enter Your Salary"<<endl;
cin>>salary;
fout<<id<<"\t"<<salary<<endl;
cout<<"Continue...."<<endl;
cin>>c;
}
cout<<"File Created"<<endl;
fout.close();
ifstream fin;
fin.open("29AP1.txt",ios::in);
char ch;
cout<<"Content of File"<<endl;
while(!fin.eof())
{
fin.get(ch);
cout<<ch;
}
fin.close();
getch();
}
No comments:
Post a Comment