Sorry, my bad

there was a typo in the if statement, it should be == not =
Here it is, corrected:
cpp
#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
int main() // starting point of program - the main function is always called this name
{
// Variable declarations
float account [3][8];
ifstream myfile("finances.txt");
int counter1 = 0;
int counter2 = 0;
if (!myfile)
{
cout << "The file could not be opened.";
getch();
exit(1); //an error code to denote what has gone wrong
}
while (counter1<3)
{
myfile >> account[counter1][counter2];
counter2++;
if (counter2==8)
{
counter2=0;
counter1++;
}
}
myfile.close();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 8; j++)
cout << account[i][j] << " ";
cout << endl;
}
// Finally, wait for a key to be pressed
getch();
return 0;
}
I hade to replace Gwin.command with the standard stuff, you shouldn't have a problem rewriting it, but if you do, let me know and we'll go through it

By the way, you have a line that looks like this:
exit(1); //an error code to denote what has gone wrongThat parameter (1) isn't an error code, it is a timer - the exit function will exit the program after a number of milliseconds, determined within the brackets. So, to exit after 1 second, it would be
exit(1000);Hope this helps
This post has been edited by gabehabe: 9 May, 2008 - 04:20 AM