#include
using namespace std;
class Alphabet {
public:
Alphabet() {
initialize();
}
char letter(const size_t index) const {
if (count <= index) return '?';
return alphabet[index];
}
private:
static constexpr size_t count = 26;
char alphabet[count];
void initialize() {
auto letter{ 'a' };
for (size_t i = 0; i < count; ++i, ++letter) {
alphabet[i] = letter;
}
}
};
int main() {
Alphabet alphabet;
size_t index;
while (true) {
cout << "index: ";
cin >> index;
cout << "letter: " << alphabet.letter(index) << '\n';
}
}