I can't seem to get my program to read all the numbers seperated by commas in my csv file. It outputs only one number.
I've looked everywhere and I can't get it to work with the csv file.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream inputFile;
int number;
// open the file //
inputFile.open("salesData.txt");
// reads the numbers from the file and displays them //
while (inputFile >> number)
{
cout << number << endl;
}
system("pause");
return 0;
}
The program outputs
5
I need it to putput
5 453.67 8769.57 221.87 600.28 8123.00