-> I'm quite new to C++!

-> How can I change letters (Abc), which I enter into a string, into fixed numbers, like A->1, B->2....Z->26, so that I get two arrays, e.g. char alpha[26] and int num[26]. Thank you very much!

Printable View

- 12-22-2001N8760Transforming letters to numbers...
-> I'm quite new to C++!

-> How can I change letters (Abc), which I enter into a string, into fixed numbers, like A->1, B->2....Z->26, so that I get two arrays, e.g. char alpha[26] and int num[26]. Thank you very much! - 12-22-2001Mecnels
/* Say letter is filled with 'A', 'B', ... */

char letter[26];

int numb[26];

for(int i=0;i<26;i++)

numb[i]=letter[i]-'A'+1;

/* I hope this is a proper answer */ - 12-23-2001N8760thanks
thank you very much!!