Matrix

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 ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    5

    Matrix

    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?

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    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?

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    5
    I thought it was matrix.h, but it doesn't seem to work. How would I declare and initiate a matrix?

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    What is the matrix?

  5. #5
    Seņor Member
    Join Date
    Jan 2002
    Posts
    561
    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.

  6. #6
    Unregistered
    Guest

    this is the matrix

    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;
    }
    //---------------------------------------------------------------------------

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 04:57 PM
  3. Gauss-Jordan Matrix Inversion in C++
    By Max_Power82 in forum C++ Programming
    Replies: 3
    Last Post: 12-03-2006, 07:31 PM
  4. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21