Keyword

i don't know what wrong with code.

  • Nguyen Huong
  • Nguyen Huong's Avatar Topic Author
  • Offline
  • New Member
More
7 years 5 months ago #162403 by Nguyen Huong
i don't know what wrong with code. was created by Nguyen Huong
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a[10][10],m,n,d,s,sum=0,e=0,f=0;
cout<<"enter the no. of companie";
cin>>n;
cout<<"enter the no. of warehouse";
cin>>m;
for(e=1;e<=m;e++)
{
for(f=1;f<=n;f++)
{
cout<<"enter values of warehouse and company"<<m<<n;
cin>>a[e][f];
}
}
for(e=1;e<=m;e++)
{
cout<<"Enter value of supply";
cin>>s;
}
for(f=1;f<=n;f++)
{
cout<<"enter value of demand";
cin>>d;
}
while(e<m)
{
if(d[e]<s[f])
{
s[f]=s[f]-d[e];
sum=sum+(s[f][e]*d[e])
e=e+1;
}
else
{
if(d[e]>s[f])
{
d[e]=d[e]-s[f];
sum=sum+(s[f][e]*s[f])
f=f+1;
}
else
{
if(d[e]==s[f])
{
d[e]=d[e]-s[f];
sum=sum+(s[f][e]*s[f])
f=f+1;
e=e+1;
}
}
}
}
cout<<"the optimal solution is:";
cin>>sum;
}


Thank You!!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #162417 by Krikor Boghossian
Replied by Krikor Boghossian on topic i don't know what wrong with code.
Hello there,

Unfortunately since this code is not related to K2, I cannot assist you.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum