-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounting_system.c
92 lines (70 loc) · 1.49 KB
/
accounting_system.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include<stdio.h>
#include <string.h>
#include <strings.h>
typedef struct Request_code
{
//stock
char Product_name[100];
int Product_stock;
int Product_price;
//visit
int Customer_id;
int Customer_store;
char Customer_type;
//order
// Customer_id
// Product_name
int Order_store;
//account
// Customer_id
}requests;
void stock(requests *RequestData,const char request[])
{
int i;
char *context; //strtok_rの為の
char *token;
int count = 0;
token = strtok_r(request," ",&context);
token = strtok_r(NULL," ",&context);
RequestData->Product_name = strtok_r(NULL," ",&context);
RequestData->Product_name = strtok_r(NULL," ",&context);
/*
for(i = 15; request[i] != ' '; i++)
{
if(request[i] != ' ')
{
product_name[i - 15] = request[i];
break;
}
}
*/
//product_name[i + 1] = '\0';
//printf("%d , %s",i,product_name);
}
int main(void)
{
char buff[100];
char action;
requests requestData;
fgets(buff,sizeof(buff),stdin);
action = buff[9];
switch (action)
{
case 's': //stock
stock(&requestData,buff);
break;
case 'v': //visit
printf("visit\n");
break;
case 'o': //order
printf("order\n");
break;
case 'a': //account
printf("account\n");
break;
default:
printf("Action Error\n");
break;
}
return 0;
}