Really i need help to complete my program but i don't know how to fix the errors ..

the program is about 2 Dimensional Arrays matrix operations

i wrote the whole program but there is some mistakes plz i need help to finish it im too confused !!

#include <iostream>
using namespace std;


template < typename T >

class Matrix
{
	private: 
		T M[100][100];
		int rowsize;
		int colsize;

	public:

		void set_par(T x, int rp, int cp)
		{
			M[rp][cp]=x;
		}

		Matrix ( int r , int c )
		{
			rowsize = r;
			colsize = c;
		}

		void add ( T x , int rp , int cp )
		{
			M[rp][cp] += x;
		
		}

		T retrieve ( int rp , int cp )
		{


			return M[rp][cp];

		}

		int getrow ()
		{


			return rowsize ;
		}

		int getcoluomn ()
		{

			return colsize ;
		}

		void display()
		{
				for ( int i=0 ; i<rowsize ; i++)
		
				{
					for ( int j=0 ; j<colsize ; j++)
					{	cout<< M[i][j];
					}
					cout<<endl;
				}
		}
};


template < typename T >

void m_add ( Matrix<T>  &z,  Matrix<T>  x , Matrix<T>  y , int r , int c )
{
	if(x.getrow()==y.getrow()  && x.getcoluomn()==y.getcoluomn())
	{
	for ( int i=0 ; i<r ; i++)
		for ( int j=0 ; j<c ; j++)
			z.set_par(x.retrieve(i,j) + y.retrieve(i,j),i,j) ;
	}

}


template < typename T >


void m_sub ( Matrix <T> &z, Matrix <T> x , Matrix <T> y , int r , int c )
{
	if(x.getrow()==y.getrow()  && x.getcoluomn()==y.getcoluomn())
	{
		for ( int i=0 ; i<r ; i++)
			for ( int j=0 ; j<c ; j++)
				z.set_par(x.retrieve(i,j) - y.retrieve(i,j),i,j) ;
	}
}

template < typename T >

void m_mult ( Matrix <T> &z, Matrix <T> x , Matrix <T> y , int r , int c , int q)
{
	if(x.getrow()==y.getrow()  && x.getcoluomn()==y.getcoluomn())
	{
		for (int i=0; i<r; i++)
		{   
			z.set_par(0,0,0);

			for (int j=0; j<c; j++)
			{          
				for (int k=0; k<q; k++)     
				{   
					z.set_par(z.retrieve+(x.retrieve(i,k) * y.retrieve(k,j)),i,j)
					z[i][j] += x[i][k] * y[k][j];     
				}  
				cout << z[i][j] << " ";  
			}    
			cout<<endl;
		}

	}
}

template < typename T >

void m_trans( Matrix <T> x , Matrix <T> y , int r , int c )
{
	if(x.getrow()==y.getrow()  && x.getcoluomn()==y.getcoluomn())
	{
		for (int i=0; i<r; i++)
			for (int j=0; j<c; j++)
				y[j][i]=x[i][j];
	}
}



int main ()
{
	int x;

	Matrix <int> A (3,3);
	Matrix  <int> B (3,3);
	Matrix <int> C (3,3);
	Matrix <int> temp (3,3);

	cout<<"Enter matrix A:"<<endl;

	for ( int i=0 ; i<3 ; i++)
		for ( int j=0 ; j<3 ; j++)
		{
			cin>>x;
			A.set_par(x,i,j);
		}
		cout<<"Enter matrix B:"<<endl;
		
		for (  i=0 ; i<3 ; i++)
			for (  int j=0 ; j<3 ; j++)
			{
				cin>> x;
				B.set_par(x,i,j);
			}
			
			cout<<"Enter matrix C:"<<endl;
			
			for (  i=0 ; i<3 ; i++)
				for (  int j=0 ; j<3 ; j++)
				{
					cin>> x;
					C.set_par(x,i,j);
				}

		m_add(temp,A,B,3,3);
		temp.display();

		m_add(temp,B,C,3,3);
		temp.display();

		m_sub(temp,B,A,3,3);
		temp.display();

		m_mult(temp,A,C,3,3,3);
		temp.display();

		m_mult(temp,C,A,3,3,3);
		temp.display();

		m_trans(temp,B,3,3);
		temp.display();

		m_trans(temp,C,3,3);
		temp.display();


		return 0;
}

what compiler are you using?

Take the error messages one at a time, then recompile to get a new list. For example, main() is missing declaration of variable i in a lot of places. The declaration of i in the first for loop is only valid for that loop. I'd suggest declaring it at the beginning of main(), like you did variable x

> i wrote the whole program but there is some mistakes
And until you adopt a better approach to writing programs, the same mistakes will keep arising.
http://cboard.cprogramming.com/c-programming/88495-development-process.html

DO NOT try to write the whole thing in one edit, press "compile" whilst sacrificing some animal to the programming gods, then posting on a message board "it doesn't work".

Fixing code is a basic skill, learn how to do it.

commented: Great advice :) +36
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.