Szubienica konsolowo w C++

Opis zadania: Gra szubienica w wersji konsolowej.

#include <iostream>
#include <time.h>
#include <conio.h>

using namespace std;

void szub01();
void szub02();
void szub03();
void szub04();
void szub05();
void szub06();


void menu() {
  cout << "Twoj wybor:" << endl;
  cout << "1 - podaj litere." << endl;
  cout << "2 - podaj haslo." << endl;
  cout << "3 - wyjscie z programu." << endl;
}

int main()
{
  srand(time(NULL));
  string tablica[] = {"tablica","kreda","klawiatura","monitor","komputer"};

  for (int i = 0; i < sizeof(tablica) / sizeof(string); i++) {
    cout << tablica[i] << endl;
  }
  int los = rand()%(sizeof(tablica) / sizeof(string));
  cout << los << endl;
  string haslo = tablica[los];
  string szukanehaslo = "";
  for (int i = 0; i < haslo.size(); i++) {
     szukanehaslo += "-";
  }
  char litera;
  char wybor;
  string calehaslo;
  int err = 0;
  bool flag = false;
  while (szukanehaslo != haslo && err < 5) {
    system("cls");
    cout << szukanehaslo << endl;
    menu();
    switch (err) {
      case 0: szub01(); break;
      case 1: szub02(); break;
      case 2: szub03(); break;
      case 3: szub04(); break;
      case 4: szub05(); break;
    }
 
  wybor = _getch();
  switch (wybor) {
    case '1': {
      cout << "Podaj litere: ";
      litera = _getch();
      for (int i = 0; i < haslo.size(); i++) {
        if (litera == haslo[i]) {
          szukanehaslo[i] = litera;
          flag = true;
       }
     }
     break;
    }
    case '2' : {
      cout << "Podaj haslo: ";
      cin >> calehaslo;
      cout << calehaslo;
      if (calehaslo == haslo) {
        flag = true;
        err = 10;
      }
      break;
    }
  }

  if (!flag) err++;
    flag = false;
  }
  system("cls");
  if (err < 5 || calehaslo == haslo) cout << "Zgadles haslo!!!" << endl << haslo << endl;
  else {
    szub06();
    cout << "Przegrana. HAHAHA!!!";
  }
  return 0;
}

void szub01() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  for (int i = 0; i < 10; i++) {
    cout << (char)186;
    for (int i = 0; i < 19; i++) cout << (char)32;
    cout << (char)186 << endl;
  }
  cout << (char)200;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)188 << endl;
}

void szub02() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  for (int i = 0; i < 9; i++) {
    cout << (char)186;
    for (int i = 0; i < 19; i++) cout << (char)32;
    cout << (char)186 << endl;
  }
  cout << (char)186;
  for (int i = 0; i < 3; i++) cout << (char)32;
  for (int i = 0; i < 13; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)200;
  for (int i = 0; i < 19; i++) cout << (char)205;
cout << (char)188 << endl;
}

void szub03() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  for (int i = 0; i < 9; i++) {
    cout << (char)186;
    for (int i = 0; i < 6; i++) cout << (char)32;
    for (int i = 0; i < 3; i++) cout << (char)219;
    for (int i = 0; i < 10; i++) cout << (char)32;
    cout << (char)186 << endl;
  }
  cout << (char)186;
  for (int i = 0; i < 3; i++) cout << (char)32;
  for (int i = 0; i < 13; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)200;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)188 << endl;
}

void szub04() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  cout << (char)186;
for (int i = 0; i < 6; i++) cout << (char)32;
for (int i = 0; i < 10; i++) cout << (char)219;
for (int i = 0; i < 3; i++) cout << (char)32;
cout << (char)186 << endl;
for (int i = 0; i < 8; i++) {
cout << (char)186;
for (int i = 0; i < 6; i++) cout << (char)32;
for (int i = 0; i < 3; i++) cout << (char)219;
for (int i = 0; i < 10; i++) cout << (char)32;
cout << (char)186 << endl;
}
cout << (char)186;
for (int i = 0; i < 3; i++) cout << (char)32;
for (int i = 0; i < 13; i++) cout << (char)219;
for (int i = 0; i < 3; i++) cout << (char)32;
cout << (char)186 << endl;

cout << (char)200;
for (int i = 0; i < 19; i++) cout << (char)205;
cout << (char)188 << endl;
}

void szub05() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 10; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 5; i++) cout << (char)32;
  cout << (char)179;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)79 << (char)32 << (char)79;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 5; i++) cout << (char)32;
  cout << (char)79;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)196;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  for (int i = 0; i < 5; i++) {
    cout << (char)186;
    for (int i = 0; i < 6; i++) cout << (char)32;
    for (int i = 0; i < 3; i++) cout << (char)219;
    for (int i = 0; i < 10; i++) cout << (char)32;
    cout << (char)186 << endl;
  }
  cout << (char)186;
  for (int i = 0; i < 3; i++) cout << (char)32;
  for (int i = 0; i < 13; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)200;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)188 << endl;
}

void szub06() {
  cout << (char)201;
  for (int i = 0; i < 19; i++) cout << (char)205;
  cout << (char)187 << endl;
  cout << (char)186; 
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 10; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 5; i++) cout << (char)32;
  cout << (char)179;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)79 << (char)32 << (char)79;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32; 
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 5; i++) cout << (char)32;
  cout << (char)79;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)196;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)218 << (char)197 << (char)191;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 5; i++) cout << (char)32;
  cout << (char)179;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)186;
  for (int i = 0; i < 6; i++) cout << (char)32;
  for (int i = 0; i < 3; i++) cout << (char)219;
  for (int i = 0; i < 4; i++) cout << (char)32;
  cout << (char)218 << (char)193 << (char)191;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  for (int i = 0; i < 2; i++) {
    cout << (char)186;
    for (int i = 0; i < 6; i++) cout << (char)32;
    for (int i = 0; i < 3; i++) cout << (char)219;
    for (int i = 0; i < 10; i++) cout << (char)32;
    cout << (char)186 << endl;
  }
  cout << (char)186;
  for (int i = 0; i < 3; i++) cout << (char)32;
  for (int i = 0; i < 13; i++) cout << (char)219;
  for (int i = 0; i < 3; i++) cout << (char)32;
  cout << (char)186 << endl;
  cout << (char)200;
  for (int i = 0; i < 19; i++) cout << (char)205;
cout << (char)188 << endl;
}