Initial commit

This commit is contained in:
Win 2024-08-28 19:00:25 +07:00
commit 482aad14f4
5 changed files with 84 additions and 0 deletions

BIN
SEN102_PreAssessment.pdf Normal file

Binary file not shown.

12
vendor1.data Normal file
View File

@ -0,0 +1,12 @@
Jay shoes 22 300
Mark dvds 10 200
Mook earrings 30 79
Woot teeshirts 23 120
Akraya donuts 35 22
Champ phonecases 15 189
Pee jeans 9 350
Chaiwat pencils 45 12
Namhom perfume 13 225
Ae socks 18 22
Q belts 10 139
Bright books 30 120

23
vendor2.data Normal file
View File

@ -0,0 +1,23 @@
Ae socks 18 22
Q belts 10 139
Bright books 30 120
Alisa kanom 10 19
Rich bags 17 450
Hey luggage 6 1200
Oat watches 9 120
Lila jackets 7 380
Mary toys 17 39
Kitty dishes 11 67
Pat comics 22 18
Jay shoes 22 300
Mark dvds 10 200
Mook earrings 30 79
Woot teeshirts 23 120
Akraya donuts 35 22
Champ phonecases 15 189
Pee jeans 9 350
Chaiwat pencils 45 12
Namhom perfume 13 225
Jill lingerie 19 140
Jacky stickers 200 10
Marisa mooping 30 20

BIN
vendorInfo Executable file

Binary file not shown.

49
vendorInfo.c Normal file
View File

@ -0,0 +1,49 @@
/*
* Win (Thanawin Pattanaphol)
* vendorInfo.c
* 8th August 2024
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX_VENDORS 20
#define MAX_FILENAME_LENGTH 4096
int read_input(char str[], int n);
struct vendor_item {
char vendor_name[20];
char merchandise[15];
int inventory_count;
int item_price_baht;
} vendors[MAX_VENDORS];
int main() {
char file_name[MAX_FILENAME_LENGTH];
read_input(file_name, MAX_FILENAME_LENGTH);
FILE *fp;
if ((fp = fopen(file_name, "r")) == NULL) {
printf("%s cannot be opened.\n", file_name);
exit(EXIT_FAILURE);
}
fclose(fp);
return 0;
};
int read_input(char str[], int n) {
int ch, i = 0;
while ((ch = getchar()) != '\n') {
if (i < n) {
str[i++] = ch;
}
}
str[i] = '\0';
return i;
}