-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
31 lines (20 loc) · 878 Bytes
/
main.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
#include <stdio.h>
#include "server/store.h"
#include "util/server_utilities/ServerUtilities.h"
int main() {
// Creating and initializing the store randomly after every execution
store_t *store = createStore();
displayStore(store);
// Adding a not already existing amount of items to the store
increaseCountOfItem("cashew nuts", 999, store);
// Adding an existing amount of items to the store
increaseCountOfItem("socks", 100, store);
// Getting the available number of items in the store of a specific item
printf("\n\nValue got: %d", getValue("cashew nuts", store->stock)->nb_items);
// Requesting an amount of items
int status = requestItem("chocolate cake", 200, store);
if (status == 0) printf("\n\nRequest was successful");
else printf("\n\nRequest was unsuccessful");
displayStore(store);
return 0;
}