files

when I enter itemcode and item and press enter it only outputs the "Enter itemcode,item and price"twice at once.
Can anyone fix the error..?
thanks..



#include<iostream>
#include<fstream>
using namespace std ;
int main()
{
int itm;
char item[20];
int n;

ofstream makelist("flab.txt");

for(int a=0;a<2;a++)
{
cout<<"Enter itemcode,item and price"<<endl;
cin>>n>>itm>>item;

makelist<<n<<itm<<item ;

}

makelist.close();
return 0;
}

That's not possible, your for loop can only run 2 times in total.
Topic archived. No new replies allowed.