Thursday, January 19, 2012
c programs: burningminds: c++ program to find saddle point of ...
c programs: burningminds: c++ program to find saddle point of ...: burningminds: c++ program to find saddle point of a matrix : //program to find saddle point of a matrix //fensams@81092 #include #include...
Saturday, January 7, 2012
c++ program to generate reverse pyramid of digits
#include<iostream.h>
#include<conio.h>
class REVERSE
{
private:
int n,i,j,k,s;
public:
void read();
void call();
};
void REVERSE::read()
{
cout<<"enter limit\n";
cin>>n;
}
void REVERSE::call()
{
s=n;
for(i=1;i<=n;i++)
{
for(k=s;k<=n;k++)
{
cout<<" ";
}
k=1;
for(j=1;j<=s;j++)
{
cout<<k++<<" ";
}
cout<<"\n";
s=s-1;
}
}
void main()
{
REVERSE a;
clrscr();
a.read();
a.call();
getch();
}
burningminds: c++ program to find saddle point of a matrix
burningminds: c++ program to find saddle point of a matrix: //program to find saddle point of a matrix //fensams@81092 #include #include class matrix { int A[50][50],row,col...
c++ program to find saddle point of a matrix
//program to find saddle point of a matrix
//fensams@81092
#include<iostream.h>
#include<conio.h>
class matrix
{ int A[50][50],row,col;
public:
void get_matrix();
void saddle();
void put_matrix();
}M;
void matrix::get_matrix()
{ cout<<"ENTER THE ROW AND COLUMN SIZE\n";
cin>>row>>col;
cout<<"ENTER THE ELEMENTS\n";
for(int i=0;i<row;i++)
for(int j=0;j<col;j++)
cin>>A[i][j];
}
void matrix::put_matrix()
{ cout<<"THE ENTERED MATRIX IS\n";
for(int i=0;i<row;i++)
{ for(int j=0;j<col;j++)
cout<<A[i][j]<<"\t";
cout<<"\n";
}
}
void matrix::saddle()
{ int big[10],small[10],i,j,max,min;
for(i=0;i<row;i++)
{ small[i]=A[i][0];
for(j=0;j<col;j++)
if(A[i][j]<small[i])
small[i]=A[i][j];
}
for(j=0;j<col;j++)
{ big[j]=A[0][j];
for(i=0;i<row;i++)
if(A[i][j]>big[j])
big[j]=A[i][j];
}
min=big[0];
for(i=0;i<row;i++)
if(big[i]<min)
min=big[i];
max=small[0];
for(j=0;j<col;j++)
if(small[j]>max)
max=small[j];
if(max==min)
cout<<"THE SADDLE POINT : "<<min;
else
cout<<"NO SADDLE POINT\n";
}
void main()
{ clrscr();
M.get_matrix();
M.put_matrix();
M.saddle();
getch();
}
Subscribe to:
Posts (Atom)