-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3150173-p3150090-p3120120-res2.c
634 lines (521 loc) · 20.9 KB
/
p3150173-p3150090-p3120120-res2.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//
// Created by paras on 23-Mar-19.
//
#include "p3150173-p3150090-p3120120-res2.h"
unsigned int seed;
unsigned int customers;
unsigned int profit = 0;
unsigned int servedCounter = 0;
unsigned int transactionsSuccess = 0;
unsigned int transactionsCardFailure = 0;
unsigned int transactionsConsecutiveSeatsFailure = 0;
unsigned int transactionsSeatsFailure = 0;
unsigned int telephonist = N_TEL;
unsigned int cashiers = N_CASH;
unsigned int totalSeats = N_SEAT * (N_ZONE_A + N_ZONE_B + N_ZONE_C);
unsigned int remainingSeats = N_SEAT * (N_ZONE_A + N_ZONE_B + N_ZONE_C);
unsigned int remainingSeatsZoneA = N_SEAT * N_ZONE_A;
unsigned int remainingSeatsZoneB = N_SEAT * N_ZONE_B;
unsigned int remainingSeatsZoneC = N_SEAT * N_ZONE_C;
bool *resultPtr;
bool *tempFlagPtr;
unsigned int *tempPtr;
unsigned int *costPtr;
unsigned int seatsPlan[N_SEAT * (N_ZONE_A + N_ZONE_B + N_ZONE_C)];
unsigned int *seedPtr = &seed;
unsigned int *profitPtr = &profit;
unsigned int *servedCounterPtr = &servedCounter;
unsigned int *transactionsSuccessPtr = &transactionsSuccess;
unsigned int *transactionsCardFailurePtr = &transactionsCardFailure;
unsigned int *transactionsConsecutiveSeatsFailurePtr = &transactionsConsecutiveSeatsFailure;
unsigned int *transactionsSeatsFailurePtr = &transactionsSeatsFailure;
unsigned int *remainingSeatsPtr = &remainingSeats;
unsigned int *remainingSeatsZoneAPtr = &remainingSeatsZoneA;
unsigned int *remainingSeatsZoneBPtr = &remainingSeatsZoneB;
unsigned int *remainingSeatsZoneCPtr = &remainingSeatsZoneC;
// Calculate time taken by a request
struct timespec requestStart, requestEnd;
struct tm start;
struct tm end;
unsigned long int totalWaitTime;
unsigned long int totalServTime;
unsigned long int *totalWaitTimePtr = &totalWaitTime;
unsigned long int *totalServTimePtr = &totalServTime;
unsigned int sleepRandom(int, int);
char zoneRandom();
unsigned int choiceRandom(int, int);
double cardRandom(double, double);
void startTimer();
void stopTimer();
void Clock();
void check_rc(int);
unsigned int Cost(unsigned int, char);
unsigned int logTransaction();
bool bookSeats(unsigned int, unsigned int, char);
void unbookSeats(unsigned int, unsigned int, char);
void printSeatsPlan();
void printInfo();
void *customer(void *x);
bool checkConsecutiveAvailableSeats(unsigned int, char);
bool POS(unsigned int, unsigned int, char);
bool checkRemainingSeats();
pthread_mutex_t operatorsLock;
pthread_mutex_t paymentLock;
pthread_mutex_t transactionLock;
pthread_mutex_t avgWaitTimeLock;
pthread_mutex_t avgServingTimeLock;
pthread_mutex_t seatsPlanLock;
pthread_mutex_t screenLock;
pthread_mutex_t cashiersLock;
pthread_cond_t availableOperators;
pthread_cond_t availableCashiers;
int main(int argc, char *argv[]) {
if (argc != 3) {
printf("Παρακαλώ δώστε μόνο το πλήθος των πελατών και τον σπόρο\n");
exit(-1);
}
// Converting string type to integer type
// using function atoi
customers = atoi(argv[1]);
*seedPtr = atoi(argv[2]);
// Checking if number of customers is positive
if (customers <= 0) {
printf("Παρακαλώ δώστε μόνο θετική τιμή για το πλήθος των πελατών\n");
exit(-2);
}
printf("Πελάτες προς εξυπηρέτηση: %03d\n\n", customers);
pthread_t threads[customers];
int id[customers];
check_rc(pthread_mutex_init(&operatorsLock, NULL));
check_rc(pthread_mutex_init(&paymentLock, NULL));
check_rc(pthread_mutex_init(&transactionLock, NULL));
check_rc(pthread_mutex_init(&avgWaitTimeLock, NULL));
check_rc(pthread_mutex_init(&avgServingTimeLock, NULL));
check_rc(pthread_mutex_init(&seatsPlanLock, NULL));
check_rc(pthread_mutex_init(&screenLock, NULL));
check_rc(pthread_mutex_init(&cashiersLock, NULL));
check_rc(pthread_cond_init(&availableOperators, NULL));
check_rc(pthread_cond_init(&availableCashiers, NULL));
startTimer();
for (int i = 0; i < customers; i++) {
id[i] = i + 1;
check_rc(pthread_create(&threads[i], NULL, customer, (void *) id[i]));
}
for (int i = 0; i < customers; i++) {
check_rc(pthread_join(threads[i], NULL));
}
stopTimer();
check_rc(pthread_mutex_destroy(&operatorsLock));
check_rc(pthread_mutex_destroy(&paymentLock));
check_rc(pthread_mutex_destroy(&transactionLock));
check_rc(pthread_mutex_destroy(&avgWaitTimeLock));
check_rc(pthread_mutex_destroy(&avgServingTimeLock));
check_rc(pthread_mutex_destroy(&seatsPlanLock));
check_rc(pthread_mutex_destroy(&screenLock));
check_rc(pthread_mutex_destroy(&cashiersLock));
check_rc(pthread_cond_destroy(&availableOperators));
check_rc(pthread_cond_destroy(&availableCashiers));
printInfo();
}
void *customer(void *x) {
unsigned int id = (int *) x;
struct timespec waitStart, waitEnd, servStart, servEnd;
struct timespec waitStartCash, waitEndCash, servStartCash, servEndCash;
// Customer calling..
check_rc(pthread_mutex_lock(&operatorsLock));
clock_gettime(CLOCK_REALTIME, &waitStart);
while (telephonist == 0) {
// Customer couldn't find telephonist available. Blocked..
check_rc(pthread_cond_wait(&availableOperators, &operatorsLock));
}
// Customer being served..
clock_gettime(CLOCK_REALTIME, &waitEnd);
check_rc(pthread_mutex_lock(&avgWaitTimeLock));
*totalWaitTimePtr += (waitEnd.tv_sec - waitStart.tv_sec);
check_rc(pthread_mutex_unlock(&avgWaitTimeLock));
--telephonist;
check_rc(pthread_mutex_unlock(&operatorsLock));
clock_gettime(CLOCK_REALTIME, &servStart);
if (checkRemainingSeats()) {
char zone = zoneRandom();
unsigned int seats = choiceRandom(N_SEAT_LOW, N_SEAT_HIGH);
sleep(sleepRandom(T_SEAT_LOW, T_SEAT_HIGH));
if (checkConsecutiveAvailableSeats(seats, zone)) {
if (bookSeats(seats, id, zone)) {
check_rc(pthread_mutex_lock(&cashiersLock));
clock_gettime(CLOCK_REALTIME, &waitStartCash);
while (cashiers == 0) {
// Customer couldn't find cashier available. Blocked..
check_rc(pthread_cond_wait(&availableCashiers, &cashiersLock));
}
// Customer being served..
clock_gettime(CLOCK_REALTIME, &waitEndCash);
check_rc(pthread_mutex_lock(&avgWaitTimeLock));
*totalWaitTimePtr += (waitEndCash.tv_sec - waitStartCash.tv_sec);
check_rc(pthread_mutex_unlock(&avgWaitTimeLock));
--cashiers;
check_rc(pthread_mutex_unlock(&cashiersLock));
clock_gettime(CLOCK_REALTIME, &servStartCash);
sleep(sleepRandom(T_CASH_LOW, T_CASH_HIGH));
if (POS(seats, id, zone)) {
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Η κράτηση ολοκληρώθηκε επιτυχώς. Ο αριθμός συναλλαγής είναι %03d", logTransaction());
check_rc(pthread_mutex_lock(&seatsPlanLock));
printf(", οι θέσεις σας είναι οι: ");
for (int i = 0; i < totalSeats; i++) {
if (seatsPlan[i] == id) {
printf("%03d ", i + 1);
}
}
check_rc(pthread_mutex_unlock(&seatsPlanLock));
printf("και το κόστος της συναλλαγής είναι %03d\u20AC\n\n", Cost(seats, zone));
check_rc(pthread_mutex_unlock(&screenLock));
}
check_rc(pthread_mutex_lock(&cashiersLock));
clock_gettime(CLOCK_REALTIME, &servEndCash);
check_rc(pthread_mutex_lock(&avgServingTimeLock));
*totalServTimePtr += (servEndCash.tv_sec - servStartCash.tv_sec);
check_rc(pthread_mutex_unlock(&avgServingTimeLock));
++cashiers;
check_rc(pthread_cond_broadcast(&availableCashiers));
check_rc(pthread_mutex_unlock(&cashiersLock));
}
}
}
check_rc(pthread_mutex_lock(&operatorsLock));
// Customer served successfully
++(*servedCounterPtr);
clock_gettime(CLOCK_REALTIME, &servEnd);
check_rc(pthread_mutex_lock(&avgServingTimeLock));
*totalServTimePtr += (servEnd.tv_sec - servStart.tv_sec);
check_rc(pthread_mutex_unlock(&avgServingTimeLock));
++telephonist;
check_rc(pthread_cond_broadcast(&availableOperators));
check_rc(pthread_mutex_unlock(&operatorsLock));
pthread_exit(NULL); // return
}
unsigned int sleepRandom(int min, int max) {
return (rand_r(seedPtr) % (max - min + 1)) + min;
}
char zoneRandom() {
double f = (double) rand_r(seedPtr) / RAND_MAX;
if (f <= P_ZONE_A) {
return 'A';
} else if (f <= (P_ZONE_A + P_ZONE_B)) {
return 'B';
} else if (f <= (P_ZONE_A + P_ZONE_B + P_ZONE_C)) {
return 'C';
}
}
unsigned int choiceRandom(int min, int max) {
return (rand_r(seedPtr) % (max - min + 1)) + min;
}
double cardRandom(double min, double max) {
double f = (double) rand_r(seedPtr) / RAND_MAX;
return min + f * (max - min);
}
void startTimer() {
Clock();
printf("Έναρξη Χρονομέτρησης\n\n");
time_t t = time(NULL);
start = *localtime(&t);
clock_gettime(CLOCK_REALTIME, &requestStart);
}
void stopTimer() {
time_t t = time(NULL);
end = *localtime(&t);
clock_gettime(CLOCK_REALTIME, &requestEnd);
Clock();
printf("Λήξη Χρονομέτρησης\n\n");
}
void Clock() {
time_t t = time(NULL);
struct tm tm = *localtime(&t);
printf("[%02d:%02d:%02d] ", tm.tm_hour, tm.tm_min, tm.tm_sec);
}
unsigned int Cost(unsigned int numOfSeats, char zone) {
check_rc(pthread_mutex_lock(&paymentLock));
unsigned int cost;
costPtr = &cost;
switch (zone) {
case 'A':
*costPtr = numOfSeats * C_ZONE_A;
break;
case 'B':
*costPtr = numOfSeats * C_ZONE_B;
break;
case 'C':
*costPtr = numOfSeats * C_ZONE_C;
break;
default:
break;
}
*profitPtr += *costPtr;
check_rc(pthread_mutex_unlock(&paymentLock));
return *costPtr;
}
unsigned int logTransaction() {
check_rc(pthread_mutex_lock(&transactionLock));
unsigned int transactionID = ++(*transactionsSuccessPtr);
check_rc(pthread_mutex_unlock(&transactionLock));
return transactionID;
}
bool bookSeats(unsigned int numOfSeats, unsigned int custID, char zone) {
check_rc(pthread_mutex_lock(&seatsPlanLock));
unsigned int temp = 0;
tempPtr = &temp;
bool tempFlag = true;
tempFlagPtr = &tempFlag;
switch (zone) {
case 'A':
for (int j = 0; j < N_ZONE_A && *tempFlagPtr; j++) {
// check if there are enough consecutive seats
for (int i = N_SEAT * j; i < (N_SEAT * (j + 1)); i++) {
if (seatsPlan[i] == 0) {
++(*tempPtr);
}
}
if (*tempPtr >= numOfSeats) {
*tempPtr = numOfSeats;
*tempFlagPtr = false;
for (int i = (N_SEAT * j); *tempPtr > 0; i++) {
if (seatsPlan[i] == 0) {
seatsPlan[i] = custID;
--(*tempPtr);
}
}
*remainingSeatsZoneAPtr -= numOfSeats;
}
}
break;
case 'B':
for (int j = N_ZONE_A; j < (N_ZONE_A + N_ZONE_B) && *tempFlagPtr; j++) {
// check if there are enough consecutive seats
for (int i = N_SEAT * j; i < (N_SEAT * (j + 1)); i++) {
if (seatsPlan[i] == 0) {
++(*tempPtr);
}
}
if (*tempPtr >= numOfSeats) {
*tempPtr = numOfSeats;
*tempFlagPtr = false;
for (int i = (N_SEAT * j); *tempPtr > 0; i++) {
if (seatsPlan[i] == 0) {
seatsPlan[i] = custID;
--(*tempPtr);
}
}
*remainingSeatsZoneBPtr -= numOfSeats;
}
}
break;
case 'C':
for (int j = (N_ZONE_A + N_ZONE_B); j < (N_ZONE_A + N_ZONE_B + N_ZONE_C) && *tempFlagPtr; j++) {
// check if there are enough consecutive seats
for (int i = N_SEAT * j; i < (N_SEAT * (j + 1)); i++) {
if (seatsPlan[i] == 0) {
++(*tempPtr);
}
}
if (*tempPtr >= numOfSeats) {
*tempPtr = numOfSeats;
*tempFlagPtr = false;
for (int i = (N_SEAT * j); *tempPtr > 0; i++) {
if (seatsPlan[i] == 0) {
seatsPlan[i] = custID;
--(*tempPtr);
}
}
*remainingSeatsZoneCPtr -= numOfSeats;
}
}
break;
default:
break;
}
bool result = (*tempPtr == 0);
if (result) {
(*remainingSeatsPtr) -= numOfSeats;
} else {
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Η κράτηση ματαιώθηκε γιατί δεν υπάρχουν αρκετές διαθέσιμες συνεχόμενες θέσεις\n\n");
check_rc(pthread_mutex_unlock(&screenLock));
check_rc(pthread_mutex_lock(&transactionLock));
++(*transactionsConsecutiveSeatsFailurePtr);
check_rc(pthread_mutex_unlock(&transactionLock));
}
check_rc(pthread_mutex_unlock(&seatsPlanLock));
return result;
}
void unbookSeats(unsigned int numOfSeats, unsigned int custID, char zone) {
check_rc(pthread_mutex_lock(&seatsPlanLock));
int temp = numOfSeats;
for (int i = 0; temp > 0 && i < totalSeats; i++) {
if (seatsPlan[i] == custID) {
seatsPlan[i] = 0;
temp--;
}
}
(*remainingSeatsPtr) += numOfSeats;
switch (zone) {
case 'A':
*remainingSeatsZoneAPtr += numOfSeats;
break;
case 'B':
*remainingSeatsZoneBPtr += numOfSeats;
break;
case 'C':
*remainingSeatsZoneCPtr += numOfSeats;
break;
default:
break;
}
check_rc(pthread_mutex_unlock(&seatsPlanLock));
}
void check_rc(int rc) {
if (rc) {
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Σφάλμα: rc\n\n");
printf("Έξοδος..");
check_rc(pthread_mutex_unlock(&screenLock));
exit(-1);
}
}
bool checkRemainingSeats() {
check_rc(pthread_mutex_lock(&seatsPlanLock));
bool result = (*remainingSeatsPtr != 0);
if (!result) {
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Η κράτηση ματαιώθηκε γιατί το θέατρο είναι γεμάτο\n\n");
check_rc(pthread_mutex_unlock(&screenLock));
check_rc(pthread_mutex_lock(&transactionLock));
++(*transactionsSeatsFailurePtr);
check_rc(pthread_mutex_unlock(&transactionLock));
}
check_rc(pthread_mutex_unlock(&seatsPlanLock));
return result;
}
bool checkConsecutiveAvailableSeats(unsigned int choice, char zone) {
check_rc(pthread_mutex_lock(&seatsPlanLock));
// check if there are enough spaces left at the theater
bool result;
resultPtr = &result;
// check if there are enough spaces left at the selected zone
switch (zone) {
case 'A':
*resultPtr = (choice <= (*remainingSeatsZoneAPtr));
break;
case 'B':
*resultPtr = (choice <= (*remainingSeatsZoneBPtr));
break;
case 'C':
*resultPtr = (choice <= (*remainingSeatsZoneCPtr));
break;
default:
break;
}
if (!*resultPtr) {
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Η κράτηση ματαιώθηκε γιατί δεν υπάρχουν αρκετές συνεχόμενες διαθέσιμες θέσεις\n\n");
check_rc(pthread_mutex_unlock(&screenLock));
check_rc(pthread_mutex_lock(&transactionLock));
++(*transactionsConsecutiveSeatsFailurePtr);
check_rc(pthread_mutex_unlock(&transactionLock));
}
check_rc(pthread_mutex_unlock(&seatsPlanLock));
return *resultPtr;
}
bool POS(unsigned int numOfSeats, unsigned int custID, char zone) {
bool result = (cardRandom(0.0, 1.0) <= P_CARD_SUCCESS);
if (!result) {
unbookSeats(numOfSeats, custID, zone);
check_rc(pthread_mutex_lock(&screenLock));
Clock();
printf("Η κράτηση ματαιώθηκε γιατί η συναλλαγή με την πιστωτική κάρτα δεν έγινε αποδεκτή\n\n");
check_rc(pthread_mutex_unlock(&screenLock));
check_rc(pthread_mutex_lock(&transactionLock));
++(*transactionsCardFailurePtr);
check_rc(pthread_mutex_unlock(&transactionLock));
}
return result;
}
void printDuration(unsigned long int minutes, unsigned long int seconds, unsigned long int totalSeconds) {
if (minutes > 1) {
printf("Διάρκεια: %ld λεπτά ", minutes);
} else {
printf("Διάρκεια: %ld λεπτό ", minutes);
}
if (seconds > 1) {
printf("και %ld δευτερόλεπτα (%lds)\n", seconds, totalSeconds);
} else {
printf("και %ld δευτερόλεπτο (%lds)\n", seconds, totalSeconds);
}
}
void printSeatsPlan() {
printf("Πλάνο Θέσεων:\n\n");
printf("Ζώνη A:\n");
int changeRow = 1;
int changeZone = 1;
printf("| ");
for (int i = 0; i < totalSeats; i++) {
if (seatsPlan[i] == 0) {
printf("Θ %03d: Π | ", i + 1);
} else {
printf("Θ %03d: Π %03d | ", i + 1, seatsPlan[i]);
}
// changing line after N_SEAT seats
if (changeRow == N_SEAT) {
changeZone += 1;
printf("\n");
if (i != (totalSeats - 1)) {
if (changeZone == N_ZONE_A) {
printf("\nΖώνη B:\n");
}
if (changeZone == N_ZONE_A + N_ZONE_B) {
printf("\nΖώνη C:\n");
}
printf("| ");
}
changeRow = 0;
}
changeRow += 1;
}
}
void printInfo() {
unsigned long int totalSeconds = (requestEnd.tv_sec - requestStart.tv_sec);
unsigned long int minutes = totalSeconds / 60;
unsigned long int seconds = totalSeconds % 60;
printf("Έναρξη: [%02d:%02d:%02d] - ", start.tm_hour, start.tm_min, start.tm_sec);
printf("Λήξη: [%02d:%02d:%02d]\n", end.tm_hour, end.tm_min, end.tm_sec);
printDuration(minutes, seconds, totalSeconds);
printf("\n");
printSeatsPlan();
printf("\n\n");
printf("Μέσος χρόνος αναμονής: %.2lu seconds\n", *totalWaitTimePtr / customers);
printf("Μέσος χρόνος εξυπηρέτησης: %.2lu seconds\n", *totalServTimePtr / customers);
printf("\n");
printf("Εξυπηρετήθηκαν: %03d πελάτες\n", *servedCounterPtr);
printf("Δεσμευμένες Θέσεις: %d\n", totalSeats - (*remainingSeatsPtr));
printf("Ελεύθερες Θέσεις: %d\n", (*remainingSeatsPtr));
printf("\n");
unsigned int totalTransactions =
*transactionsSuccessPtr + *transactionsCardFailurePtr + *transactionsConsecutiveSeatsFailurePtr +
*transactionsSeatsFailurePtr;
printf("Συναλλαγές [Σύνολο]: %d\n", totalTransactions);
printf("Συναλλαγές [Επιτυχής]: %d%% (%d)\n", (((*transactionsSuccessPtr * 100) / (totalTransactions))),
*transactionsSuccessPtr);
printf("Συναλλαγές [Ανεπιτυχής λόγω μη αποδοχής κάρτας]: %d%% (%d)\n",
(((*transactionsCardFailurePtr * 100) / (totalTransactions))), *transactionsCardFailurePtr);
printf("Συναλλαγές [Ανεπιτυχής λόγω μη συνεχόμενων θέσεων]: %d%% (%d)\n",
(((*transactionsConsecutiveSeatsFailurePtr * 100) / (totalTransactions))),
*transactionsConsecutiveSeatsFailurePtr);
printf("Συναλλαγές [Ανεπιτυχής λόγω μη ύπαρξης θέσεων γενικά]: %d%% (%d)\n",
(((*transactionsSeatsFailurePtr * 100) / (totalTransactions))), *transactionsSeatsFailurePtr);
printf("Κέρδη: %d\u20AC\n", (*profitPtr));
printf("\nΈξοδος..\n");
}