Программа заканчивается после первого прохода case
Пишу многофайловый проект. Сделал Switch, чтобы сначала в программу забить данные, а потом с ними работать и при необходимости менять, но почему то после ввода, программа заканчивается и я не могу работать с данными. Подскажите, пожалуйста, в чем проблема, только учусь :) Вот куски кода:
//HEADER.H
#pragma once;
class Trl
{
public:
void CREATE_TRL(map<int, set<string>>& Trl);
void TRL_IN_STOP(map<int, set<string>>& Trl, string stop);
};
//HEADER.CPP
#include "Header.h"
void Trl::CREATE_TRL(map<int, set<string>>& Trl)
{
string command;
int name, quantity;
string stop;
cout << "Enter the name of trolley bus:" << endl;
cin >> name;
cout << "Enter the quantity of stops:"<<endl;
cin >> quantity;
cout << "Enter the name of stop:" << endl;
for (int i = 0; i < quantity; i++)
{
cin >> stop;
Trl[name].insert(stop);
}
}
void Trl::TRL_IN_STOP(map<int, set<string>>& Trl, string stop)
{
for (const auto& i : Trl)
{
for (const auto& elem : Trl[i.first])
{
if (elem == stop)
{
cout << "Number of tram for stop: " << i.first << endl;
}
}
}
}
//SOURCE
#include "Header.h"
enum class type
{
CREATE_TRL,
};
string command;
int main()
{
map<string, int> mapping;
int CREATE_TRL;
int TRL_IN_STOP;
int STOPS_IN_TRL;
int TRLS;
mapping["CREATE_TRL"] = 1;
mapping["TRL_IN_STOP"] = 2;
mapping["STOPS_IN_TRL"] = 3;
mapping["TRLS"] = 4;
Trl trl_1;
map<int, set<string>> Trls;
cout << "Enter the command:" << endl;
getline(cin, command);
while (mapping[command] != 0)
{
switch (mapping[command])
{
case 1:
{
trl_1.CREATE_TRL(Trls);
cout << "Enter the command:" << endl;
getline(cin, command);
}
break;
case 2:
{
string stop;
cout << "Enter the name of stop: " << endl;
getline(cin, stop);
trl_1.TRL_IN_STOP(Trls, stop);
}
cout << "Enter the command:" << endl;
getline(cin, command);
break;
}
}
}