added functions

This commit is contained in:
Win 2024-08-29 20:04:02 +07:00
parent f3ab5d2efd
commit e0ca79c4d0
1 changed files with 12 additions and 1 deletions

View File

@ -62,7 +62,8 @@ int main()
int total_vendors = index - 1; int total_vendors = index - 1;
printf("\n>>> Read %d vendors from file %s\n", total_vendors, file_name); printf("\n>>> Read %d vendors from file %s\n", total_vendors, file_name);
// print out each vendor's info
for (int i = 0; i <= total_vendors; i++) for (int i = 0; i <= total_vendors; i++)
{ {
char vendor_info[200]; char vendor_info[200];
@ -79,6 +80,9 @@ int main()
printf("%-50s %s\n", vendor_info, vendor_stock); printf("%-50s %s\n", vendor_info, vendor_stock);
} }
char user_purchase[50];
fclose(fp); fclose(fp);
free(file_buffer); free(file_buffer);
@ -100,3 +104,10 @@ int read_input(char str[], int n)
str[i] = '\0'; str[i] = '\0';
return i; return i;
}; };
int purchase(struct vendor_item vendors, int index, char str[], int amount)
{
}