arrays - Why aren’t my functions printing when I try to access them in the main function? -


#include "stdafx.h"   #include <iostream>   #include <cstdlib>  #include <string>   using namespace std;       class matrix{       int m, n, i, j, first[10][10], second[10][10], sum[10][10];           public:     void initmatrix();      void printmatrix();           };     void matrix::initmatrix()   {        cout << "enter number of rows of matrices"; cin >> m;         cout << "enter number of columns of matrices"; cin >> n;        cout <<  "enter elements of first matrix\n";         (i=0; i<m; ++i)        {          (j=0; j<n; ++j)          {            cin >> first[i][j];           }        }        cout << "enter elements of second matrix\n";                      (i=0; i<m; ++i)         {            (j=0; j<n; ++j)            {              cin >> second[i][j];            }          }    }       void matrix::printmatrix()    {             for(i=0; i< m; i++)         {            for(j=0; j<n; j++)            {               sum[i][j]= first[i][j] + second[i][j];              }          }                   // print sum matrix           cout << "sum of entered matrices\n";           for(i= 0; i<m; i++)          {             for(j=0; j<m; j++)            {               cout << sum[i][j] << "\t";            }          }    }   int main()   {             matrix m1;              cout << m1.initmatrix() << endl;              cout <<  m1.printmatrix() << endl;                        cout << "hit key continue" << endl;          system ("pause");          return 0;   } 

hello everyone,

i working on c++ application in create matrix class has attributes , arrays , public methods , create instance of class creating object access 2 of methods defined in class declaration. how can use 2 of methods output information defined in methods? here code far. doing wrong?


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -