hey,

I am having a lot of trouble trying to get this program to work. It is supposed to read integers from a file and place them into the categories for inventory. I think the problem is that the program is not actually reading from the file, but I have no idea how to fix it. Any help or suggestions woulud be great, I swear i probably tried everything

#include <stdio.h>

int main(void)

{

int PartNo[5];

float Price[5];

int QOH[5];

int ReorderPt[5];

int MinOrder[5];

int x[4];

int i;

int y;

FILE *Fp1;

Fp1 = fopen("data.txt", "r");

for(y=0;y<5;y++)

{

for(i=0;i<4;i++)

fscanf(Fp1,"%d",&x[i]");

PartNo[y] = ((x[0]*1000)+(x[1]*100)+(x[2]*10)+x[3]);

}

for(y=0;y<5;y++)

{

for(i=0;i<4;i++)

fscanf(Fp1, "%f", &x[i]);

Price[y] = ((x[0]*1000)+(x[1]*100)+(x[2]*10)+x[3])/100;

}

for(y=0;y<5;y++)

{

for(i=0;i<4;i++)

fscanf(Fp1, "%d", &x[i]);

QOH[y] = ((x[0]*1000)+(x[1]*100)+(x[2]*10)+x[3]);

}

for(y=0;y<5;y++)

{

for(i=0;i<4;i++)

fscanf(Fp1, "%f", &x[i]);

ReorderPt[y] = ((x[0]*1000)+(x[1]*100)+(x[2]*10)+x[3]);

}

for(y=0;y<5;y++)

{

for(i=0;i<4;i++)

fscanf(Fp1, "%f", &x[i]);

MinOrder[y] = ((x[0]*1000)+(x[1]*100)+(x[2]*10)+x[3]);

}

for(y=0;y<5;y++)

{

if(QOH[y]<ReorderPt[y])

QOH[y] = QOH[y]+MinOrder[y];

}

printf("\n\b |-----------------------------------------------------------|");

printf("\n\b |Part Number --- Price --- Quantity on Hand --- Reorder Point --- Minimum Order |");

printf("\n\b |-----------------------------------------------------------|");

printf("\n | %4d --- %2.2f --- %2d --- %2d |", PartNo[0], Price[0], QOH[0], ReorderPt[0], MinOrder[0]);

printf("\n | %4d --- %2.2f --- %2d --- %2d |", PartNo[1], Price[1], QOH[1], ReorderPt[1], MinOrder[1]);

printf("\n | %4d --- %2.2f --- %2d --- %2d |", PartNo[2], Price[2], QOH[2], ReorderPt[2], MinOrder[2]);

printf("\n | %4d --- %2.2f --- %2d --- %2d |", PartNo[3], Price[3], QOH[3], ReorderPt[3], MinOrder[3]);

printf("\n | %4d --- %2.2f --- %2d --- %2d |", PartNo[4], Price[4], QOH[4], ReorderPt[4], MinOrder[4]);

printf("\n\b |-----------------------------------------------------------|");

return 0;

}