Witam mam pytanie, a mianowicie czemu w kodzie poniżej tablica słów string działa a const char * po paru wylosowaniach zawiesza program? Chodzi oczywiście o tablicę words z 7 linijki.
#include <iostream>
#include <random>
#include <time.h>
const int LIM = 26;
using std::string;
const char * words[LIM] = {"agrest", "bigos", "czara",
"drewno", "ekipa", "figura", "gorycz", "hiena", "iskra",
"junior", "krata", "lizak", "miska", "nurek", "obuwie",
"pisak", "rozum", "smalec", "taryfa", "umiar", "video",
"welon", "yeti", "zalew", "zimno", "zapas"};
int main()
{
using std::cout;
using std::cin;
using std::endl;
srand(time(NULL));
cout << "Zagraj w wisielca!" << endl;
char play;
cout << "Chcesz zagrac? ";
cin >> play;
play = tolower(play);
string target;
int guesses = 6;
while (play == 't')
{
guesses = 6;
target = words[rand() % LIM];
cout << target << endl;
cout << "Jeszcze raz?";
cin >> play;
play = tolower(play);
}
return 0;
}