У меня есть следующий класс:
#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
Вектор не обновляется после выполнения метода класса (С++) ⇐ C++
Программы на C++. Форум разработчиков
-
Anonymous
1766488583
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
Подробнее здесь: [url]https://stackoverflow.com/questions/78087280/vector-is-not-updated-after-performing-a-class-method-c[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия