What is the header file for matrixes?
How would I use a matrix to add information into a file, and then retrieve the information from the file?
This is a discussion on Matrix within the C++ Programming forums, part of the General Programming Boards category; What is the header file for matrixes? How would I use a matrix to add information into a file, and ...
What is the header file for matrixes?
How would I use a matrix to add information into a file, and then retrieve the information from the file?
In my opinion a matrix is just a 2x2 array. As far as I know there is no special header file for it. Why would you need such header file?
I thought it was matrix.h, but it doesn't seem to work. How would I declare and initiate a matrix?
What is the matrix?
Matrix = 2D array.
int matrix[2][2]; // initializes a 2X2 "matrix" (array) of int's
double matrix[2][60]; //initialized a 2X60 of doubles
No header file needed. It's built into C++.
If you are talking about apmatrix used in apcs, it's apmatrix.h, but you have to download it somewhere. But don't use that cuz it's slow and crappy.
here take this code if u want to understand matrix
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#pragma argsused
#include <iostream>
#include <conio>
using namespace std;
//---------------------------------------------------------------------------
int main()
{
int i, j;
int x[3][3], y[3][3], z[3][3];
//**************** first Matrix Starts Here ******************************//
for( i = 0; i < 3; i++)
{
for( j =0; j < 3; j++)
{
cout << "Enter a Integer for First Matrix:-" << "\n";
cin >> x[i][j];
}
}
cout << "\nThe First Matrix" << "\n";
for( i = 0; i < 3; i++)
{
for( j =0; j < 3; j++)
{
cout << x[i][j] ;
}
cout << "\n" ;
}
//*************** Second Matrix Starts here ***************************//
for( i = 0; i < 3; i++)
{
for( j =0; j < 3; j++)
{
cout << "Enter a Integer for Second Matrix:-" << "\n";
cin >> y[i][j];
}
}
cout << "The Second Matrix" << "\n";
for( i = 0; i < 3; i++)
{
for( j =0; j < 3; j++)
{
cout << y[i][j] ;
}
cout << "\n" ;
}
//*************** Sum Of Matrix *****************************************//
cout << "\nSum Of Matrix:-" << "\n";
for( i = 0; i < 3; i++)
{
for( j = 0; j < 3; j++)
{
z[i][j] = x[i][j] + y[i][j];
cout << z[i][j];
}
cout << "\n";
}
//*************** Multiplication Of Matrix ******************************//
cout << "\nMultiplication Of Matrix :-" << "\n";
for( i = 0; i < 3; i++)
{
for( j = 0; j < 3; j++)
{
z[i][j] = x[i][0] * y[0][j] + x[i][1] * y[1][j] + x[i][2] * y[2][j];
cout << z[i][j];
}
cout << "\n";
}
getch();
return 0;
}
//---------------------------------------------------------------------------