How to give a value to a string?

Hey there

I am writing a program that will choose a name from a list for you.
It works like this: You input your name, it gives you another name from a list, depending on your name, simple as that.

So, supposing the list has 28 options, i would divide the value of the string by 28 and use the rest to determine the final name.

Now, the thing is, how do i "assign" a value to a string? I was thinking of summing the ascii values for each letter but i don't know how to do that :<

If anyone has a suggestion it will be greatly appreciated too.

Thanks in advance! :)
For example:
1
2
3
4
5
6
7
8
#include <string>
#include <numeric>
...

std::string name = "Hello, Dolly!";

int value = 0;
value = std::accumulate( name.begin(), name.end(), value );
Thanks a lot!!
That fixed the problem :D
Topic archived. No new replies allowed.