#include<iostream>
#include<fstream>
usingnamespace std ;
int main()
{
int itm;
char item[20];
int n;
ofstream makelist("labsht.txt");
for (int a=0;a<5;a++)
{
cout<<"Enter itemcode,item and price"<<endl;
cin>>n>>item>>itm ;
makelist<<n<<item<<itm ;
}
makelist.close();
return 0;
}
this program is to print saved data.
but it gives this output
"1 d222bb433gf445dfd448dfdfdf4 0"
i want to get line by line.
can anyone help me to get the required output..?
thanks
#include<iostream>
#include<fstream>
usingnamespace std;
int main()
{
int s;
char b[2];
int c;
ifstream show("labsht.txt");
while(!show.eof())
{
show>>s>>b>>c;
cout<<" "<<s<<" "<<b<<" "<<c<<" "<<endl;
}
return 0;
}