this is what i have coded
Code:
#include <stdio.h>
int main()
{
char ingred[50][50]= {" "};
int amount[50]= {0};
char month[50][50]= {" " };
int i = 0;
FILE *ptr;
ptr = fopen ("OrderList.txt","r");
printf ("\t\t\t\tINGREDIENTS\t\tAMOUNT \t\tMONTH");
while(!feof(ptr))
{
fscanf (ptr,"%s%d%s",ingred[i], &amount[i], month[i]);
printf ("\t\t\t\t%s\t\t%d\t\t%s\n", ingred[i], amount[i], month[i]);
i++;
}
what i want to do is is search the file for Eg: "FLOUR" and then calculate the running total for every occurrence of flour