added search function, still incomplete
This commit is contained in:
parent
e0ca79c4d0
commit
d8fc155229
BIN
vendorInfo
BIN
vendorInfo
Binary file not shown.
30
vendorInfo.c
30
vendorInfo.c
|
@ -7,12 +7,11 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#define MAX_VENDORS 20
|
#define MAX_VENDORS 20
|
||||||
#define MAX_FILENAME_LENGTH 4096
|
#define MAX_FILENAME_LENGTH 4096
|
||||||
|
|
||||||
int read_input(char str[], int n);
|
|
||||||
|
|
||||||
struct vendor_item
|
struct vendor_item
|
||||||
{
|
{
|
||||||
char vendor_name[20];
|
char vendor_name[20];
|
||||||
|
@ -21,6 +20,9 @@ struct vendor_item
|
||||||
int item_price_baht;
|
int item_price_baht;
|
||||||
} vendors[MAX_VENDORS];
|
} vendors[MAX_VENDORS];
|
||||||
|
|
||||||
|
int read_input(char str[], int n);
|
||||||
|
int search(struct vendor_item vendors[MAX_VENDORS], char query[]);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
char file_name[MAX_FILENAME_LENGTH];
|
char file_name[MAX_FILENAME_LENGTH];
|
||||||
|
@ -81,8 +83,14 @@ int main()
|
||||||
printf("%-50s %s\n", vendor_info, vendor_stock);
|
printf("%-50s %s\n", vendor_info, vendor_stock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
char user_purchase[50];
|
char user_purchase[50];
|
||||||
|
|
||||||
|
=======
|
||||||
|
char query[100];
|
||||||
|
read_input(query, 100);
|
||||||
|
search(vendors, query);
|
||||||
|
>>>>>>> ff1cef9 (added search function, still incomplete)
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(file_buffer);
|
free(file_buffer);
|
||||||
|
@ -105,9 +113,27 @@ int read_input(char str[], int n)
|
||||||
return i;
|
return i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
int purchase(struct vendor_item vendors, int index, char str[], int amount)
|
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)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
deez lmao deez deez
|
Loading…
Reference in New Issue