How do I convert a string from my CSV file (excel worksheet) to a float value? Suppose that my CSV sheet contains:
0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1
and my code so far is:
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main()
{
    ifstream myfile("data1.csv");
    string line;
    getline(myfile,line,',');
    cout << line;
}
I am able to obtain line as a string, specifically type Ss but I need to convert the line into a float. How do I do that?
 
     
    