completely new to C++ and I have to use this programming language. And never done programming before.
Basically I need to read a matrix from a stored file so it's output can be seen when you press the debug button.
When I've tried doing the matrix
1 3 5
2 4 6
5 7 9
When I come to reading it, it comes up with the matrix but in a line so.... 1 3 5 2 4 6 5 7 9.
So does anybody know how to get it so it's read as a matrix, if that's possible?
In the future I then need to find the determinant of the matrix e.t.c. And do other sums between multiple matrices.
Here is what I currently have:
#include <iostream>
#include <conio.h>
#include <cmath>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
char filename[50];
ifstream matrixA;
cin.getline(filename, 50);
matrixA.open(filename);
if (!matrixA. is_open())
{
exit (EXIT_FAILURE);
}
char word[50];
matrixA >> word;
while (matrixA.good())
{
cout << word << " ";
matrixA >> word;
}
system("pause");
return 0;
}