E19MATRX - for(int i=0;i<3;i++) { for(int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream.h> #include<conio.h> # class mat { int m[3][3]; public: void getm(); void putm(); mat operator+(mat); mat operator-(mat); }; } void mat::getm() { cout<<"Enter the matrix "; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cin>>m[i][j]; } } } void mat::putm() { cout<<"The matrix is \n"; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { cout<<m[i][j]<<" "; } cout<<"\n"; } } mat mat::operator+(mat b) { mat c;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for(int i=0;i&lt;3;i++) { for(int j=0;j&lt;3;j++) { c.m[i][j]=m[i][j]+b.m[i][j]; } } return (c); } mat mat::operator-(mat b) { mat c; for(int i=0;i&lt;3;i++) { for(int j=0;j&lt;3;j++) { c.m[i][j]=m[i][j]-b.m[i][j]; } } return (c); } void main() { clrscr(); mat m1,m2,m3,m4; m1.getm(); m2.getm(); m3=m1+m2; m4=m1-m2; m3.putm(); m4.putm(); getch(); }...
View Full Document

Page1 / 2

E19MATRX - for(int i=0;i&amp;amp;lt;3;i++) { for(int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online