string manipulation

i am trying to get the total value of a string for my encryption program but am only getting value of the first character of the string. here is my code

for(int c = 0; c<=password.length(); c++){
int add;
add = password[c];
pass = pass+add;
}

where pass is an int and password is string containing password.
please correct or show alternate code.
thanks!
Make sure to put your code in [code][/code] tags so it is formatted properly.

Remember that arrays (like your string) go from 0 to size-1 only. Other than that, it looks fine. Have you stepped through it with a debugger?
Topic archived. No new replies allowed.