i'm trying to read from a file and the file only gave 1 2 3 4 but the output is 1 2 3 4 4
#include <iostream>
#include <fstream>
using namespace std;
//declare matrix
const int size=100;
typedef int matrix[size][size];
matrix matA;
matrix matB;
matrix result;
int main()
{
fstream read;
read.open("matrix A.txt", ios::in);
while(!read.eof())
{
int temp;
read >> temp;
cout << temp << endl;
}
}
i already saved the integer in different .cpp file, and the assignment asked to read the matrix using different .cpp