How to get an easier way of generating the alphabet in C++?

You could use std::iota, which is a great algorithm for this use case:

char albet[26] {};
std::iota(std::begin(albet), std::end(albet), 'a');

Here's a demo.

Note that this is not guaranteed to work in c++, unless you have ASCII encoding, but if you can rely on that you'll be fine.


One rather obvious answer is missing.

When you need a character array you do not have to use individual character literals one by one, as in

char albet[] = {'a','b','c','d','e','f',... uff this is tedious ...};

You can use a string literal instead:

const std::string albet{"abcdefghijklmnopqrstuvwxyz"};

Took me ~10 seconds to type and compared to other answers, this does not rely on ASCII encoding (which is not guaranteed).