I want it to print if "LINDO" is said or print that way if "lpsolve" is said need help

//March 2021
// Collin Brown, Jada Satchell, Deric N
//Compiler: C++ Shell

#include <iostream>
#include <string>
using namespace std;

const int LIMIT=90; // change this number to fit your array

void chose_program( Format);

void test_constraints(double count[]); //This is the name or our function

int main()
{

std::cout << "Made by: Jada Satchell, Collin Brown, Deric"<< endl;
cout << "Made in 2021"<< endl;
cout << "This code is made to put our teams LP modle in LINDO and lP solve form."<< endl;

choose_program
{
cout << " Would you want to see the LP modle in LINDO or in lp solve ?"<< endl; //HERE!!
cin >> Format


if(LINDO)
{
cout<<"//OBJECTIVE FUNCTION//"<<endl;
cout<<"Z=120X1 + 90X2 + 120X3 + 90X4 + 2.4X5 + 1.8X6 + 2.4X7 + 1.8X8 \n"<<endl;

cout<<"//OBJECTIVE FUNCTION//"<<endl;
double count[LIMIT] = {1,0,0,0,-1,0,0,0,130,0,1,0,0,0,-1,0,0,95,0,0,1,0,1,0,-1,0,200,0,0,0,1,0,1,0,-1,150,0,0,0,0,0,0,1,0,25,0,0,0,0,0,0,0,1,25,3.5,2.6,0,0,0,0,0,0,900,3.5,2.6,0,0,0,0,0,0,1100,3.5,2.6,-3.5,-2.6,0,0,0,0,100,-3.5,-2.6,3.5,2.6,0,0,0,0,100};
test_constraints(count);


void test_constraints(double count[])
{

int j=0;
int subscript=0; //

for(j=0; j<LIMIT;j++)
{
subscript++;
cout<<count[j]<<"X"<<subscript;

if(subscript<8)
{
if(count[j+1] >= 0)
{
cout<<"+";
}
}

else
{
cout<<">=";
j++;
cout<<count[j]<<endl;
subscript=0;

}
if(lpsolve)
{
double count[LIMIT] = {1,0,0,0,-1,0,0,0,130,0,1,0,0,0,-1,0,0,95,0,0,1,0,1,0,-1,0,200,0,0,0,1,0,1,0,-1,150,0,0,0,0,0,0,1,0,25,0,0,0,0,0,0,0,1,25,3.5,2.6,0,0,0,0,0,0,900,3.5,2.6,0,0,0,0,0,0,1100,3.5,2.6,-3.5,-2.6,0,0,0,0,100,-3.5,-2.6,3.5,2.6,0,0,0,0,100};
test_constraints(count);


void test_constraints(double count[])
{

int j=0;
int subscript=0; //

for(j=0; j<LIMIT;j++)
{
subscript++;
cout<<count[j]<<"X"<<subscript;

if(subscript<8)
{
if(count[j+1] >= 0)
{
cout<<"+";
}
}

else
{
cout<<">=";
j++;
cout<<count[j]<<endl;
subscript=0;
system("pause");
}
}
}
Last edited on
no idea what you want to do, perhaps should provide a description and some examples
You can't define a function within a function eg you can't define another function within main(). When the function has been forward declared (as here), the function definition can come after main()

Also, it's much easier to read code if it's nicely formatted and code tags used.
Topic archived. No new replies allowed.