below is the code I have so far which works, my question is how do I then go from here to include a menu so operations can be performed on the matrices that are read from the text files?
Examples for operations could be the determinant, add, subtract e.t.c.
#include <iostream> //declaring variables
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
string code(string& line);
int main()
{
int MatrixA[3][3] = {{1,0,0},{0,2,0},{0,0,3}};
ofstream outf;
ifstream myfile;
string infile;
string line;
string outfile;
cout << "Please enter an input file (A.txt) for Matrix A or (B.txt) for Matrix B" << endl;
cin >> infile; //prompts user for input file
if (infile == "A.txt")
{ //read whats in it and write to screen
myfile.open("A.txt");
cout << endl;
while (getline (myfile, line))
cout << line << endl;
//float elements[9];
//ifstream myfile("A.txt");
//myfile >> elements[0] >> elements[1] >> elements[2];
//myfile >> elements[3] >> elements[4] >> elements[5];
//myfile >> elements[6] >> elements[7] >> elements[8];
//myfile.close();
}
else
if (infile == "B.txt")
{
myfile.open("B.txt");
cout << endl;
while (getline (myfile, line))
cout << line << endl;
}
else
{
cout << "Unable to open file." << endl;
}
//{
//while("Choose next operation");
//}
return 0;
}