#include<iostream>
#include<conio.h>
#include<fstream>
using namespace std;
int main()
{
char name[20];
int cost;
ofstream outf("data"); //file name declaration..
cout<<"Enter the item name :";
cin>>name;
cout<<"Enetr the item cost :";
cin>>cost;
outf<<name<<endl; //output from user..
outf<<cost<<endl;
outf.close();
ifstream inf("data");
inf>>name;
inf>>cost;
cout<<"\n Item name : "<<name;
cout<<"\n Item cost :"<<cost;
inf.close();
getch();
return 0;
}
No comments:
Post a Comment