i'm asking for homework help. i've come to my wits end trying to figure this out and it's due midnight tommorrow est.
i'm supposed to write a program to read an inventory file and create the inventory report ( i did that with the given data minus the 5 column headings like it told me to). along with the 5 columns, the report is also going to include the order amount ( calculated as the sum of the reorder point and the minimum order less the quantity on hand). i am to provide a report heading and ending message ( done) and i'm to print the part number with leading zeros. my teacher told us to save the inventory txt in the root directory but my computer wont allow me to because i have vista. he also said we could save it where our project solution is saved (?!!!??). i've only done the first part of my code because i don't think i'm going about this the right way. i've searched the web and i don't think i want to read a whole line but i'm not sure and there isn't an example in my book that is close to this project ( to my limited understanding).
here is my code:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
void ordAmt( int reOrder, int minOrd, int quant);
int _tmain(void)
{
// local declarations
FILE*spInventRep;
int partn;
int price;
int quant;
int reOrder;
int minOrd;
int ordAmt;
//Statements
spInventRep = fopen("C:\Users\Jenniy\Desktop\ch 7\inventory09.txt", "r");
if ((spInventRep = fopen("inventory09.txt", "r")) ==NULL)
{
printf("Error opening file\n");
} // if
printf("\t\t\t Inventory Report\n\n");
printf("Part Number");
fscanf(spInventRep, "%4f", &partn);
printf("\t Price");
do
{
fscanf(spInventRep, "%5.2f", &price);
if (partn= 0123) [B]\\ these are given in the inventory report [/B]
&price = 1.23; [B]\\ as are these, but there are suposed to be loops according to the examples in the book...U.U[/B]
if (partn= 0234)
&price= 2.34;
if (partn= 3456)
&price= 34.56;
if (partn= 4567)
&price= 45.67;
if (partn= 5678)
&price= 6.78;
}while (partn != EOF);
printf("\t Quantity on Hand");
fscanf(spInventRep, "%3f", &quant);
printf("\t Reorder Point");
fscanf(spInventRep, "%2f", &reOrder);
printf("\t Minimum Order");
fscanf(spInventRep, "%2f", &minOrd);
printf("\t Order Amount");
fscanf(spInventRep, "%3f", &ordAmt);
printf("\n\n\n\t\t\t End of Report");
return 0;
}
Thank you anyone for helping...