Вектор не обновляется после выполнения метода класса (С++)C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Вектор не обновляется после выполнения метода класса (С++)

Сообщение Anonymous »

У меня есть следующий класс:
#include
#include
#include
#include
#include
#include
#include

using namespace std;

class HotelManagement {

public:

HotelManagement() : hotel_clients(),hotel_rooms(), hotel_time(){}

void Book (int time, string hotel_name, int client_id, int room_count){
hotel_clients[hotel_name].push_back(client_id);
hotel_rooms[hotel_name].push_back(room_count);

hotel_time[hotel_name][time] = hotel_time[hotel_name].size();
current_time = time;
}

int Clients(string hotel_name){
map times = hotel_time[hotel_name];
if(times.empty()){
return 0;
}

int time_start = current_time - 86400;
int time_end = current_time;

auto start_it = times.upper_bound(time_start);
auto end_it = times.lower_bound(time_end);

int number_clients = end_it->second - start_it->second;

for (auto it = times.begin(); it != times.end(); ++it) {
std::cout > query_count;

for (int query_id = 0; query_id < query_count; ++query_id) {
string query_type;
cin >> query_type;

if (query_type == "BOOK") {
int time, client_id, room_count;
string hotel_name;
cin >> time >> hotel_name >> client_id >> room_count;
hotel.Book(time, hotel_name, client_id, room_count);
} else if (query_type == "CLIENTS") {
string hotel_name;
cout

Подробнее здесь: https://stackoverflow.com/questions/780 ... s-method-c
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»