I wrote a program that receives values and transfers them to a column in Excel.
I wrote a while loop that would receive a line from the excel file and it would insert the value into the vector but it doesn't work. I would appreciate help
#include <iostream>
using namespace std;
#include <fstream>
#include <string>
/*
int main()
{
ofstream exc1;
exc1.open("e.csv");
float x;
cout << " enter x: \n press ctrl z to stop \n";
while (cin >> x)
{
exc1 << x << endl;
}
exc1.close();
}
*/
#include <vector>
int main()
{
ifstream exc1;
exc1.open("e.csv");
string line;
vector <string> x;
int i = 0;
while (getline(exc1, line, ','))
{
x.push_back(line);
cout << x.at(i);
i++;
}
cout << "vector: \n";
cout<<x.at(1);
cout<<x.at(2);
cout<<x.at(3);
exc1.close();
}