0

i have a task how to link two files
to read from oneanother
like a search
this is what i have

please help
this is urgently needed


ofstream outfile;
fstream myfile;

outfile.open("Inventory.txt");
myfile.open("Invoice.txt");
outfile<< "\n\nWELCOME TO THE INVENTORY\n";
outfile<< "========================\n";
outfile<<"Item ID"<<setw(10)<<"Name"<<setw(16)<<"Descrition";


cout<<"Please fill in the following information\n\n";
cout<<"Item ID: ";
cin>>ID;
cout<<"Name: ";
cin >>name;
cout<<"Description: ";
cin>>description;
outfile<<ID<<setw(9)<<name<<setw(10)<<description;

myfile<<"\n\n WELCOME TO INVOICE\n";
myfile<<"=======================\n";
cout <<"Enter item ID: ";
cin>>IDs;
for (int i =0; i<=ID; i++)
{
if(IDs == ID)
{
cout <<"ID found";
}
}
this loop is not correct
i want to be able to search in the
inventory file for the corresponding ID
typed here in the invoice

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Salem
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.