Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,167 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,882 people online right now. Registration is fast and FREE... Join Now!




I have problem to calculate invetory level?

 
Reply to this topicStart new topic

I have problem to calculate invetory level?

little student
6 Dec, 2007 - 12:29 PM
Post #1

New D.I.C Head
*

Joined: 29 Mar, 2007
Posts: 1


My Contributions
hi every body
I have big project but I have problem in one question because I cannot understand it very well but I try to write this code but I can not implement please I need help because I have not more time to
this is guestion:-
Write a program by useing c++ that demonstrates a simple inventory system that calculates the number of items to be ordered after each week of business and the inventory-level for the beginning of the following week. Use parameters for the number of items demanded by the customer and the amount ordered from the supplier.
this my code:-
CODE
#include<iostream.h>
/* varabel I it means Inventory level ,I[0]  initial inventory level in company ,
I[n] final inventory level in company and I suppose that initial and fainal inventory level equal
S(max inventory level inc ompany and s(mini inventory level in company ) , O(order from customer )*/

int calculat()
{

int I[7],s,S,i=0,d[7],o[7];
cout<<"what the mini inventory in company\n";
cin>>s;
cin>>"what the max inventory level in busines\n";
cin>>S;

I[0]=S;

while(i<=7)
{
    cout<<"how many demaned from customer\n";
    cin>>d[i];
    i++;
    if(I[i-1]<s)
        o[i-1]=S-I[i-1];
    else
        o[i-1]=0;

    I[i]=I[i-1]+o[i-1]-d[i];
}
int n=i;
o[n]=S-I[n];
I[n]=S;
return I[1] ,I[7],o[n];
}
void main()
{
    cout<<"the invetory levei at begging and end of week\n";
cout<<calculat();
}


*Mod Edit: Added code tags: code.gif
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: I Have Problem To Calculate Invetory Level?
6 Dec, 2007 - 10:25 PM
Post #2

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,858



Thanked: 49 times
Dream Kudos: 550
My Contributions
I wish you all the luck. You have a program that is... well I don't care to read it over and I doubt your teacher will care for it either.

You ACTUALLY have variables 's' and 'S', 'o' and 'O'? What you don't like names like "initialInventory", "finalInventory", "customerOrder"?

So, you post this code that is hardly readable, doing the one thing that really irritates programmers who have to read other peoples code ("hell is other peoples code" -- and this is a good example of why.) You offer no idea of what is wrong with the code, why you posted it etc....


What is your question? Note that we do not do peoples homework.

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 12:16AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month