0
If you wanted to give a value to each letter of the alphabet, how would you?
Aside from labeling each individual letter to a value, is there an easier way to do this?
3 Réponses
+ 2
Easy
char[] = "abcdefghijklmnopqrstuvwxyz";
Use the respective index as a value.
Like char[0] equals a
other solution:
You can loop using chars. just start in 'a' and checks if letter <= 'z' and incremment letter if not. Use this to give any value that you want
+ 1
for (char c = 'a'; c <= 'z'; c++)
std::cout << c << ", ";
you can just increment characters