hi guys,
i am stuck... we have to show wats in a file.... then at the end show the grand total of the Profits .. heres the report func....
void report()
{
struct Prods ssg;
double prof;
FILE *f;
f = fopen("data.dat","rb");
printf("\n\n\n==============================================================================\n");
printf("Prod# Type Description Qty Cost Price Profit\n");
printf("==============================================================================\n");
while(fread(&ssg,sizeof(ssg),1,f))
{
printf("\n%-9d%-7d%-21.18s%-2d%13.2lf%13.2lf%13.2lf\n",
ssg.prodnum, ssg.prodt, ssg.desc, ssg.prodquan, ssg.prodcost, ssg.prodprice, profits(ssg.prodprice, ssg.prodcost, ssg.prodquan));
}
printf("\n==============================================================================\n");
//print grand total of PROFIT
printf("%d",prof);
fclose(f);
}
<< moderator edit: added [code][/code] tags >>
thx...