Functions and Member functions.

What are required functions and member functions to enable the following program production the correct result.(Only need to write the declaration for functions and member function.)

I Need Hint.

#include <iostream>
using namespace std;



class cat { friend istream& product>>(istream &a,cat &b); private: int row, col,colc, *data;
friend ostream& product<<(ostream& a, cat &b);
public: cat() { row = col = 0; data = 0;
}

cat(int r, int c) {row = r; col = c; data = new int [row*col];}
cat(cat &a ) { row=a.row; col = a.colc; data = new int [row*col];
for (int i=0; i< row*col; i++) data[i]=a.data[i];

}

~cat()

{
if (data !=0) delete [] data;

}

void showMatrix()
{
int w=0, j;
for (int i = 0; i<row; i++)
{
for (j=0; j<col; j++)

{
cout<<data[w] << ' '; w++;
}

cout<<endl;
}

cout <<endl;
} };


cat product(cat &a, cat &b)
{
cat tmp( a.row, b.col);
int s, i, j;

for (i=0; i<a.row; i++)
for (j=0; j<b.col; j++)
for (tmp.data[i*b.col+j] = 0, s=0; s<a.col; s++)

tmp.data[i*b.col+j] +=a.data[i*a.col+s]*b.data[s*b.col+j];
return tmp;

}

int main() { int m, n ,k;

cout<< "enter row no. of the matrix A: "; cin >>m;
cout<<"enter column no. of the matrix A: "; cin >>n;
cout<<"enter column no. of the matrix B: "; cin >>k; cat a (m, n); cat b(n, k);

istream& product>>(istream &a,cat &b); ostream& product<<(ostream& a, cat &b); cat c; c=a* b; ostream& product<<(ostream& c);

system("pause");
return 0;

}
I'm sorry, but I can't even *read* that. Put it in code tags, indent it properly and stop stacking up statements on the same line. Then I'll try to answer.
Also be a little bit clearer with your question. Explain what you are trying to do and keep your grammar high in your priorities list.
Topic archived. No new replies allowed.