C++ reading files, array variable matrix -


What I am trying to achieve is the matrix that I have in two separate text files, Users of the program whose messages have been printed on the console. However, it is necessary to perform on the matrix in future operations, so someone told me that I need to identify text files in the form of matrix. If this makes sense?

So I let him go one and even I have this code. That's why I'm getting all the matrix A

  1 1   

where I would like

  0 0 The fact for Matrix B is that it prints the text file but does not read it as a matrix.  

I do not know what I want to know about it, if someone can help, it would be good!

  #include & lt; Iostream & gt; // declared variable #include & lt; iomanip & gt; #include & lt; String & gt; # Include & lt; Fstream & gt; using namespace std; String code (string and line); int main () {int MatrixA [3] [3] = {{1.0,0}, {0,2,0}, {0}}}; Offstream outage; Instream MyFile; String Infail; String line; String outfile; Cout & lt; & Lt; "Please enter an input file (ATX) or for Matrix B (B.T.T) for Matrix B" & lt; Endl; Cin & gt; & Gt; in file; // indicates the user for the input file if (infile == "A.txt") {// read it and write on myfile.open ("A.txt") screen; Cout & lt; & Lt; Endl; While (gateline (mime, line)) cout & lt; & Lt; Matrix A [0] [0] & lt; & Lt; Endl; } And if (infile == "B.txt") {myfile.open ("B.txt"); Cout & lt; & Lt; Endl; While (gateline (mime, line)) cout & lt; & Lt; Line & lt; & Lt; Endl; } And {cout & lt; & Lt; "unable to open file." & Lt; & Lt; Endl; } // {// while ("Choose Next Operation"); //} return 0; }   

Now I have this

  if (infile == "A.txt") {// reads it and writes to write on the screen Is = 0; Myfile.open ("a.txt"); Cout & lt; & Lt; Endl; While (line> gt;> MatA [j] [0]> gt; Mutay [ja] [1]> gt;> mata [ja] [2]); J ++; // while (gateline (mime, line)) cout & lt; & Lt; Line & lt; & Lt; Endl; // float element [9]; // ifstream myfile ("A.txt"); //Myfile & gt; & Gt; Element [0] & gt; & Gt; Element [1] & gt; & Gt; Elements [2]; //Myfile & gt; & Gt; Element [3] & gt; & Gt; Element [4] & gt; & Gt; Elements [5]; //Myfile & gt; & Gt; Element [6] & gt; & Gt; Element [7] & gt; & Gt; Elements [8]; //myfile.close ();   

But where 'line & gt; & Gt; ' Is & gt; & Gt; There is an error in saying that no operator matches these operators? Can you explain what it means? And tips on how this can be solved?

Change cout < & Lt; Matrix A [0] [0] & lt; & Lt; Andal; to cout & lt; & Lt; Line & lt; & Lt; Endl; The above code is not certain that I understand what the meaning of "identity as matrix" is. A text file is a text file and nothing else. If you have incorrect data in it, there is no way to determine that this is the matrix, unless you do not check for some errors (such as the number of elements in each row is the same number).

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -