Apr 19, 2009 at 12:51pm
If the string was cab
How would I convert to an ascii value so it would be 294?
thanks.
Apr 19, 2009 at 12:55pm
Sum the values of the characters:
string[0] + string[1] + ... + string[length-1]
and cast the result to an integer
Last edited on Apr 19, 2009 at 12:55pm
Apr 19, 2009 at 12:56pm
how would you do that?
Im sort of new to c++
Apr 19, 2009 at 1:12pm
I'd suggest you a for
loop, from 0 to the string length-1 and use subscripting to add to the sum:
sum += yourstring[i];
Last edited on Apr 19, 2009 at 1:12pm
Apr 20, 2009 at 11:34am
subscripting is the [ ] operator