PROGRAM For MINIMIN METHOD.

SOURCE CODE :

//programed by Paras Wadher
MCA
Nagpur university

//PROGRAM TO OBTAIN SOLUTION OF PROBLEM USING MINIMIN METHOD.
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<process.h>
class minimin
{
float a[30][30],r,min[10],c,m,k;
public:
void getdata(void);
void cal(void);
};
void minimin::getdata()
{
cout<<“\n Enter the no of alternative “;
cin>>r;
cout<<“\n Enter the no of events “;
cin>>c;
cout<<“\n Enter the pay off matrix\n”;
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
cin>>a[i][j];
}
}
}
void minimin::cal()
{
int i,j;
for(i=0;i<r;i++)
{
min[i]=a[i][0];
for(j=0;j<c;j++)
{
if(a[i][j]<min[i])
min[i]=a[i][j];
}
}
cout<<“The minimin values are \n”;
for(i=0;i<r;i++)
{
cout<<” “<<min[i];
}
m=min[0];
for(i=0;i<r;i++)
{
if(min[i]<m)
{
m=min[i];
k=i;
}
}
cout<<“\n \n The minimum value is”<<m;
cout<<“\n”<<k+1<<“=ALTERNATIVE SELECTED”;
}
void main()
{
clrscr();
minimin mm;
mm.getdata();
mm.cal();
getch();
}
OUTPUT:


Enter the no of alternative 4

Enter the no of events 4

Enter the pay off matrix
7 12 20 27
10 9 10 25
23 20 14 23
32 24 21 17
The minimin values are
7 9 14 17

The minimum value is7
1=ALTERNATIVE SELECTED

Leave a Reply

Your email address will not be published. Required fields are marked *