I have no problem in reading the contents of file , but I want to store the values in an array format. How can I do it ?
Contents of file:
1,2,4,4,0,30,15,7.6,5
1,2,4,5,0,0,0,0,0
1,3,2,1,0,40,29,14,9.6
1,3,2,2,0,0,19,9.4,6.2
Code:
ifstream infile;
infile.open ("test.txt");
if (infile.is_open())
{
while (infile.good())
{
cout << (char) infile.get();
}
infile.close();
}
else
{
cout << "Error opening file";
}
return 0;