ASCI code in array

Aug 12, 2009 at 1:13am
hello.. I am new here in cplusplus.com.. and I'm here to ask a question regarding with our project in school "the ASCI code in array form".. please help me to get the codes on how to do it.. by the way, letters from A-Z only even the small ones.. thanks..
Aug 12, 2009 at 7:52am
You can just use the character literals to get the ASCII codes:
1
2
3
4
int /*or char or whatever type you need*/ array[26];
//fill it:
for ( int l = 'A'; l <= 'Z'; l++ )
    array[l-'A'] = l;
Aug 13, 2009 at 2:45am
ahh.. so you mean I'm just going to use the "for loop statement"?..
ok thanks.. one more thing, am I going to use the same format in "for" with the other letters?
Aug 13, 2009 at 7:50am
Yes, Notice that this loop would work properly only if the encoding is ASCII for sure
Aug 14, 2009 at 2:38am
ok..i'll try to do it..thanks..
Topic archived. No new replies allowed.