I need to write a program that reads data from one file ( parts.txt) that contains information on parts sold. Each line in the file contains information on one part as follows -

part number(integer), selling price(double)and the quantity in stock(integer) The data is stored into an array. I need to read from another file (orderinfo.txt) and search for a particular part number. The 2nd file contains information for order requests. Each line in the file contains - an order num (int), part num and quantity requested (int)

If the part number is there, the order was successful.

All I have so far is shown below. I'm a newbie, can anyone recommend any good reading materials to help me?

#include <stdlib.h>

#include <stdio.h>

int main () {

FILE * in=fopen ("partData.txt", "r");

FILE * out=fopen("report.txt", "w");

int partNum[100];

double price [100];

int quantityS [100];

for (int j=0;j < 100; j++)

fscanf(in, "%d", &partNum[j]);

for (int x=0; x < 100;x++)

fscanf (in, "%d", &price[x]);

for (int z=0; z < 100; z++)

fscanf(in, "%d", quantityS[z]);

fclose(in);

in = fopen ("orders.txt","r");

int a,b,c;

fscanf (in, "%s", &a);

fscanf (in, "%s", &b);

fscanf (in, "%s", &c);

fclose(in);

}

int partNum[100];

int x,y;

void selectionSort (int PartNum[], int size) {

for (x!=0; x <=size; x=x+1){

int smallest = x;

for (int y = x+1; y < size, y=y+1;

if partNum [y] < partNum [smallest]

smallest=y;

int temp = partNum[smallest];

partNum[smallest] = partNum[x];

partNum[x] = temp;

}

int partNum[100];

int BinarySearch ( int partNum []), int size, int b) {

int lo = 0, hi=size-1;

while (lo <= hi) {

int mid (lo+hi)/2

if (partNum[mid] == b);

return mid;

if (partNum[mid] < b)

lo = mid + 1;

else

hi = mid - 1

}

return -1

}

}