From d8fc15522918fee362c38d4c9eefb1eff98d2e1a Mon Sep 17 00:00:00 2001 From: Win Date: Sat, 31 Aug 2024 11:16:43 +0700 Subject: [PATCH] added search function, still incomplete --- vendorInfo | Bin 17464 -> 17584 bytes vendorInfo.c | 30 ++++++++++++++++++++++++++++-- vendorbad.data | 1 + vendorblank.data | 0 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 vendorbad.data create mode 100644 vendorblank.data diff --git a/vendorInfo b/vendorInfo index 93fa37dd3cd9167564a6957a91e77d0438bb3e7b..12061c085d678f89e2c41ea698ecbdc599d58f3e 100755 GIT binary patch delta 2276 zcmZ8j4NOy46u!3dH6xxcwYeeD<>*LoVe|_>Z9@(5?!h)F!1R)wt00D=|3=m*x z1rpdvRA#bavN$rA4OY!q4A6m@EYU=hnMmRmwz%Y(5LY&xKXbmF``#;{H+lEmbIy0Z zbM9|D<)sroI&3#*m<7U`+7mJ{^2Qg&JcD8*c_WK_RA!{AWJZF8x{PBr~HGpzzHD<0pR*gHq1K{y|m z_V%k>y#XsSYGG zU}b(k2G00IL>9$oW8WHIM8Ae_;_a0~(*ow3IfxUKwzF9dU1kPxHbf)=vkpv4Y~@OTOxR1Le>6&--f?^W7!Q>-ZzKK#o8AN&LA6YiBI}SIvO_YNbF3wSi zG2v)pEfqh;E#bnNAj!GO89*=5qiIKs=_6g~>k(o9hDApj$VM~`;x`8MPFoSvzQQl~ zP?kGUuA+5q46LB9qj@*hVO{Uvg>HY3b5pd#WD%HyENO3+_7aifV0NYGQf-jsI)Ha- z#FauXz@*DVyJ5wZVxEdn!?bsdc)`i@v<9m96zcM~@{yFL`CBs{Q)B2cd=FZ)5{->o znntF3}hzr0GJL%RgwGxV5 zG1^UN?}N!)-W)1Av zej0kV*&NpqY1WyDK|8^rREsc)UJ1PxoQz4EzOuUrSy33mVTapRZ`ZMs9mG^7gn|{B zgm#NAhSX^b6gq{&8fR$7(zK{t#G8>Pbm3dVR7VlZlDSLE(kBQSUKQ`NELb6X@|D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XU8{|%+EP$%+HT^a>G7UA1*hRT|VV2n`Wlj%wT}#2X^q@)qc8DEl8zhwM54 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