Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Services / EventService.cpp
diff options
context:
space:
mode:
Commit4da4dc9f7658a25eb90647a49514680976d5c382 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 12:13:01 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 12:13:01 +0300
Filesfb407976f369c281cc850243de1f1f6b2be867ae /src/Services/EventService.cpp
FMI-OOP-P1_TicketSystem-4da4dc9f7658a25eb90647a49514680976d5c382.tar
FMI-OOP-P1_TicketSystem-4da4dc9f7658a25eb90647a49514680976d5c382.tar.gz
FMI-OOP-P1_TicketSystem-4da4dc9f7658a25eb90647a49514680976d5c382.zip
Parentbc40623884434af1a16c4d84765fdb8719d74dff (diff)
Autocommit at 07.05.2022 @ 12:13
1 files changed, 7 insertions, 7 deletions
-rw-r--r--src/Services/EventService.cpp14
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index 58b355f..ac3129d 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -135,8 +135,8 @@ StatusCode EventService::buyTicket(const char* name, const Date& date, const Tic
return Success;
}
-void EventService::createSeatingString(const char* name, const Date& date, unsigned* seatsPerRow, char* out) {
- delete[] out;
+void EventService::createSeatingString(const char* name, const Date& date, unsigned* seatsPerRow, char** out) {
+ delete[] *out;
unsigned eInd = indexOfEvent(name, date);
if (eInd == events.get_count()) {
@@ -146,18 +146,18 @@ void EventService::createSeatingString(const char* name, const Date& date, unsig
unsigned rowCount = events[eInd].get_hall().get_rows(), seatsCount = events[eInd].get_hall().get_seatsPerRow();
*seatsPerRow = seatsCount;
- out = new char[rowCount * seatsCount + 1];
+ *out = new char[rowCount * seatsCount + 1];
for (unsigned acc = 0, row = 1; row <= rowCount; row++) {
for (unsigned seat = 1; seat <= seatsCount; seat++, acc++) {
if (events[eInd].get_tickets().contain(Ticket(row, seat)))
- out[acc] = 'B';
+ *out[acc] = 'B';
else if (events[eInd].get_reservations().contain(Ticket(row, seat)))
- out[acc] = 'R';
+ *out[acc] = 'R';
else
- out[acc] = ' ';
+ *out[acc] = ' ';
}
}
- out[seatsCount * rowCount] = '\0';
+ *out[seatsCount * rowCount] = '\0';
}