You are on page 1of 2

cout<<" \t"<<x[i][j];

}
getch();
return 0;
}

Sum of elements of matrix :42


The matrix is:
10 9 8
8 3 4

10.CLASS IMPLEMENTATION
#include<conio.h>
#include<iostream.h>
class area
{
int b, h;
double ar;
public:
void input_data()
{
cout<<"\n Enter base:";
cin>>b;
cout<<"\n Enter height:";
cin>>h;
}
void calculate()
{
input_data();
ar=0.5*b*h;
}
void output()
{
calculate();
cout<<"\n Area of triangle:"<<ar;
}
};

int main()
{
clrscr();
area A;
A.output();

You might also like