I am working on my school project and was wondering If I could make my code look cleaner by replacing:
switch (screen) {
case 0:
switch (language) {
case 0:
std::cout << "1 - Start new game" << std::endl;
std::cout << "2 - Load save" << std::endl;
std::cout << "2 - Hall of fame" << std::endl;
std::cout << "3 - Select language" << std::endl;
std::cout << "h - Help" << std::endl;
break;
case 1:
std::cout << "1 - Zacznij nową grę" << std::endl;
std::cout << "2 - Wczytaj grę" << std::endl;
std::cout << "2 - sala sławy" << std::endl;
std::cout << "3 - wybierz język" << std::endl;
std::cout << "h - pomoc" << std::endl;
break;
}
break;
}
by something like this:
switch (screen)(language) {
case 0 0:
std::cout << "1 - Start new game" << std::endl;
std::cout << "2 - Load save" << std::endl;
std::cout << "2 - Hall of fame" << std::endl;
std::cout << "3 - Select language" << std::endl;
std::cout << "h - Help" << std::endl;
break;
case 0 1:
std::cout << "1 - Zacznij nową grę" << std::endl;
std::cout << "2 - Wczytaj grę" << std::endl;
std::cout << "2 - sala sławy" << std::endl;
std::cout << "3 - wybierz język" << std::endl;
std::cout << "h - pomoc" << std::endl;
break;
}
Is there any construction like this in c++? I tried googling it, but no matter the phrasing I couldn't find anything.