You don't need a vector if you're only going to store one value. The most straightforward way to do it would be:
#include <string> // This needs to be in your headers
float n;
std::string value = "47.65";
n = stof(value) // n is 47.65. Note that stof is needed instead of stoi for floats
If you need several values, this is how you would do it:
#include <string>
std::vector<std::string> values;
values.push_back("47.65");
values.push_back("12.34");
//...
std::vector<float> floatValues;
for (int i = 0; i <= values.size(); i++) {
floatValues.push_back(stof(values[i]));
// intValues is a vector containing 47.65 and 12.34
}
If you're looking to remove the decimal places in your strings before parsing them, you can use the following code:
#include <algorithm> // This also needs to be in your headers
#include <string>
int n;
std::string value = "47.65";
std::replace(value.begin(), value.end(), '.', '')
n = stoi(value) // n is 4765. This time we're using atoi since we have an int