Experiment No. 2: AIM: - Write
Experiment No. 2: AIM: - Write
2
AIM: - Write a program in C++ to formulate a LPP by simplex method.
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,a[10],v;char cond[3],ccond[10];int noc,b[10][10],c,rhs[10];
cout<<"Enter the details of objective function:-";
cout<<"\n\nMax. or Min.";
gets(cond);
cout<<"\n\nEnter the no. of variables:- ";
cin>>v;
cout<<"\n\nEnter the coefficients of the variables:- ";
cout<<"\n";
for(i=1;i<=v;i++)
{
cin>>a[i];
}
cout<<"\n\nEnter the no. of constraint";
cin>>c;
for(i=0;i<c;i++)
{
cout<<"\nEnter the coefficients of constraint number
"<<i+1<<":";
for(j=0;j<v;j++)
{
cin>>b[i][j];
}
cout<<"x"<<i+1;
if(i<v-1)
{
cout<<",";
}
}
cout<<">=0";
getch();
}