Files question

Status
Not open for further replies.

Thunder

Wise, Aged Ars Veteran
108
I have to make a program that reads an inventory file and create an inventory report that contains six headings, then I have to calculate the order amount when the quantity on hand falls below the reorder point for each item. My question is how would I go about getting all the info for each item in a its on seperate row?

e.x part no. price quantity reorder
444 5.55
 

AlphaMeridian

Ars Legatus Legionis
17,136
Moderator
Hmm. I have a project that is almost EXACTLY like this, except it's for computers and we have to calculate commission. My solution was thus:

Code:
if (length(name) > 7) //If it's more than 7, do this.
{
	cout<<name<<"\t"<<MSRP<<"\t\t"<<cCost<<"\t\t"<<dealProfit<<"\t\t"<<comm<<endl;
}
else //if it's less than 7, do this.
{
	cout<<name<<"\t\t"<<MSRP<<"\t\t"<<cCost<<"\t\t"<<dealProfit<<"\t\t"<<comm<<endl;
}

maybe the tabs can help you line up the data in your program.

-Alpha
 

Thunder

Wise, Aged Ars Veteran
108
here is what I have so far...

#include <fstream.h>


int main ()
{


ifstream fsAuto;

fsAuto.open("parts.dat");
if (!fsAuto )
{
cerr << "Error opening parts file" << endl;
}

cout << "part no." << "\t price" << "\t
quantity"<<"\t Reorder point"
<< "\t Minimum order"<< endl;


fsAuto.close();

return 0;
}

all the parts.dat file has is a lits of numbers, and it wont show up, do i have to do some kind of loop just to have the file show up?
 
Status
Not open for further replies.