diff --git a/vendorInfo b/vendorInfo index 93fa37d..12061c0 100755 Binary files a/vendorInfo and b/vendorInfo differ diff --git a/vendorInfo.c b/vendorInfo.c index ad9998c..97f7cb1 100644 --- a/vendorInfo.c +++ b/vendorInfo.c @@ -7,12 +7,11 @@ #include #include #include +#include #define MAX_VENDORS 20 #define MAX_FILENAME_LENGTH 4096 -int read_input(char str[], int n); - struct vendor_item { char vendor_name[20]; @@ -21,6 +20,9 @@ struct vendor_item int item_price_baht; } vendors[MAX_VENDORS]; +int read_input(char str[], int n); +int search(struct vendor_item vendors[MAX_VENDORS], char query[]); + int main() { char file_name[MAX_FILENAME_LENGTH]; @@ -81,8 +83,14 @@ int main() printf("%-50s %s\n", vendor_info, vendor_stock); } +<<<<<<< HEAD char user_purchase[50]; +======= + char query[100]; + read_input(query, 100); + search(vendors, query); +>>>>>>> ff1cef9 (added search function, still incomplete) fclose(fp); free(file_buffer); @@ -105,9 +113,27 @@ int read_input(char str[], int n) return i; }; +<<<<<<< HEAD int purchase(struct vendor_item vendors, int index, char str[], int amount) { } +======= +int search(struct vendor_item vendors[MAX_VENDORS], char query[]) +{ + int query_length = strlen(query); + for (int i = 0; i < query_length; i++) + { + query[i] = tolower(query[i]); + }; + printf("Query: %s\n", query); + return 0; +}; + +int purchase(struct vendor_item vendors[MAX_VENDORS], char str[], int amount) +{ + +}; +>>>>>>> ff1cef9 (added search function, still incomplete) diff --git a/vendorbad.data b/vendorbad.data new file mode 100644 index 0000000..9664a62 --- /dev/null +++ b/vendorbad.data @@ -0,0 +1 @@ +deez lmao deez deez diff --git a/vendorblank.data b/vendorblank.data new file mode 100644 index 0000000..e69de29