- #include<iostream.h>//programmingisbest.blogspot.com
- #include<fstream.h>//programmingisbest.blogspot.com
- #include<conio.h>//programmingisbest.blogspot.com
- #include<stdlib.h>//programmingisbest.blogspot.com
- char name[15];//programmingisbest.blogspot.com//programmingisbest.blogspot.com
- char telephn[10];//programmingisbest.blogspot.com//programmingisbest.blogspot.com
- char city[15],opt;
- ofstream xyz("nnn.dat");//programmingisbest.blogspot.com
- int rec =1;//programmingisbest.blogspot.com
- clrscr();
- if(!xyz)//programmingisbest.blogspot.com
- {
- cout<<"file is not open";
- exit(1);
- }
- opt='y';
- while(opt=='y' || opt=='Y')
- {
- cout<<"\n Enter the record no # : "<<rec;
- cout<<"\n Enter the name of the customer: ";
- cin>>name;
- cout<<"\n Enter the telephone no of the customer : ";
- cin>>telephn;
- cout<<"\n enter the city of the customer : ";
- cin>>city;
- xyz<<name<<"\t"<<telephn<<"\t"<<city<<endl;
- rec ++;
- cout<<"\n enter more record press (Y/n)";
- cin>>opt;
- }
- }
- #include<iostream.h>
- #include<fstream.h>
- #include<conio.h>
- #include<stdlib.h>
- main()
- {
- char name[15];//programmingisbest.blogspot.com
- char telephn[10];
- char city[15];//programmingisbest.blogspot.com
- int rec =1;
- ifstream xyz("nnn.dat");
- clrscr();//programmingisbest.blogspot.com
- if(!xyz)
- {
- cout<<"file is not open";
- exit(1);
- }
- while(xyz)
- {
- xyz>>name>>telephn>>city;//programmingisbest.blogspot.com
- cout<<"\nrecod no is # : "<<rec;//programmingisbest.blogspot.com
- cout<<"\nName is : "<<name;//programmingisbest.blogspot.com
- cout<<"\ntelephone no is : "<<telephn;
- cout<<"nCity is : "<<city;//programmingisbest.blogspot.com
- rec++;//programmingisbest.blogspot.com
- }
- }