I have a double array, and would like to give each member of the array the int (ASCII) value of a string, which is part of a struct. This is how I did it:
1 2 3 4 5
double array[1000];
for(int i = 0; i < blabla; i++)
{
array[i] = string[i].struct;
}
For some reason, this doesn't work. It says the std::string can't be converted to double. However, if I replace the string that's part of a struct with a regular string, it appears to work fine. I have no idea what I'm doing wrong here, and would really appreciate some help.
It's a regular string. The variable isn't actually named struct, sorry, I just put that up there to show it's the name of the struct. But I just realized I didn't write it the right way, this is what I meant:
1 2 3 4 5
double array[1000];
for(int i = 0; i < blabla; i++)
{
array[i] = struct[i].string;
}
It underlines the struct and says there's no suitable conversion function from std::string to double.
But the purpose of all this is to be able to compare entire strings (for sorting). So I would need more than just the first character, but I'm not sure how to achieve that...