Hello All,
Here is the assignment...
"Create a program that manages inventory bins in a warehouse. Each bin holds a number of the same type of part. The program should use a structure that keeps the following information: Description of the part kept in the bin, Number of parts in the bin.
Create an array of ten of these structures, whose elements should be initialized with the data on page 564.
The Program should have the following functions as detailed on page 564: DisplayBins(), addParts(),removeParts().
The program should begin by initializing the array with the data for each of the 10 bins (you can allow the end user to put this in). Then it should enter a loop that:
1) calls the displayBins function to display the current bin status
2) Allows the user to choose to either quit the program or select a bin
3) If a bin is selected, allows the user to choose whether to ad parts to it or remove parts from it
4) Have the user input the number of parts to be added or removed
5) Call the appropriate function to add or remove parts
After the user exits the loop, a final call should be made to the displayBins function before ending the program.
<no bin can hold more than 30 parts, do not allow user to remove parts from an empty bin, accept only positive integers (counting numbers) as amounts to add or remove from the bin>"
...and here is my code
so far...
CODE
#include <iostream>
#include <iomanip>
using namespace std;
void showBin (int [], int);
int main()
{
const int SIZE = 10;
int array1[SIZE] = {10,5,15,21,7,5,5,25,18,12};
int count;
int menu, addremove, add, remove, binnum;
cout<<"********************************************** \n";
cout<<"* MENU * \n";
cout<<"* * \n";
cout<<"* 1. Select a Bin * \n";
cout<<"* 2. View Bins * \n";
cout<<"* 3. Quit * \n";
cout<<"********************************************** \n";
cin>>menu;
switch (menu)
{
case 1:
{
cout<<"**************************************** \n";
cout<<"* ENTER THE BIN NUMBER YOU WISH TO USE * \n";
cout<<"* 1. Valve 2. Bearing * \n";
cout<<"* 3. Bushing 4. Coupling * \n";
cout<<"* 5. Flange 6. Gear * \n";
cout<<"* 7. Gear Housing 8. Vaccum Gripper * \n";
cout<<"* 9. Cable 10. Rod * \n";
cout<<"**************************************** \n";
cin>>binnum;
cout<<"******************************* \n";
cout<<"* 1. Add to bin * \n";
cout<<"* 2. Remove from bin * \n";
cout<<"******************************* \n";
cin>>addremove;
switch(addremove)
{
case 1:
{
cout<<"Enter how many parts you wish to add to bin"<< binnum<<". \n";
cin>>add;
int addedbin = array1[binnum] + add;
cout<<"bin "<<binnum<<" now has "<<addedbin<<endl;
break;
}
case 2:
{
cout<<"Enter how many parts you wish to remove from bin"<< binnum<<". \n";
cin>>remove;
int rembin = array1[binnum] - remove;
cout<<"bin "<<binnum<<" now has "<<rembin<<endl;
break;
}
break;
}
break;
}
case 2:
{
showBin (array1, SIZE);
break;
}
case 3:
{
cout<<"Thanks for using Inventory. Come back soon!!! \n";
break;
}
return 0;
}
void showBin (int nums[], int SIZE)
{
for (int count = 0; count < SIZE; count++)
cout<<nums[count]<<" ";
cout<<endl;
}
I'm getting 2 errors when compiling this code.
CODE
error C2601: 'showBin' : local function definitions are illegal
and
CODE
fatal error C1004: unexpected end of file found
...can someone help me out?
Thanks!
-Adam