Logo 
Search:

OOPs Concept Answers

Ask Question   UnAnswered
Home » Forum » OOPs Concept       RSS Feeds
  Question Asked By: Fiqah Roslan   on Mar 27 In OOPs Concept Category.

  
Question Answered By: Ana Waninie   on Mar 27

#include <iostream.h>

class Matrix
{
int num[5][5];
public:
void readValues ();
void showValues();
};

void Matrix::readValues()
{
cout<< "Insert 5 x 5 matrix : \n" <<endl;
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
cin>>num[i][j];
}
}
}

void Matrix::showValues()
{
cout<< "\nMatrix contains : \n" <<endl;
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
cout<<num[i][j] << " ";
}
cout<<endl;
}
}

int main()
{
Matrix matrix;
matrix.readValues();
matrix.showValues();

char wait;
cin >> wait;
return 0;
}

Share: 

 
 
Didn't find what you were looking for? Find more on read a matrix of size 5x5, Or get search suggestion and latest updates.


Tagged: