1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#include <iostream>
using namespace std;
struct bins {
string partDesc;
int numParts;
};
const int myParts = 10;
bins description[myParts]={
{"Valve", 10},
{"Bearing", 5},
{"Bushing", 15},
{"Coupling", 21},
{"Flange", 7},
{"Gear", 5},
{"Gear Housing", 5},
{"Vacuum Gripper", 25},
{"Cable", 18},
{"Rod", 12}
};
void display(bins);
int AddParts(bins&);
int RemoveParts(bins&);
int main()
{
int i;
int bin;
int add;
int add_part;
int sub;
int choice2;
char choice1;
bins part;
display(part);
do
{
cout << "Would you like to modify a bin? Y/N: ";
cin >> choice1;
if(choice1 == 'Y' || choice1 == 'y');
{
cout << "Enter 0 for Valve, 1 for Bearing, 2 for Bushing, 3 for Coupling, 4 for Flange, 5 for Gear, 6 for Gear Housing, 7 for Vacuum Gripper, 8 for Cable, 9 for Rod: ";
cin >> bin;
cout << "Would you like to add or remove to the bin? Type 1 to add, 2 to remove: ";
cin >> choice2;
switch (choice2)
{
case 1:
break;
case 2:
RemoveParts(part);
break;
}
}
cout << endl;
cout << "Would you like to continue? Y/N: ";
cin >> choice1;
while (choice1 == 'N' || choice1 == 'n');
display(part);
system("pause");
}
while (choice1 == 'N' || choice1 == 'n');
return 0;
}
void display (bins)
{
for (int i=0; i < myParts; i++)
{
cout << "Part Description: " << description[i].partDesc << endl;
cout << "Number of Parts in the Bin: " << description[i].numParts << endl;
}
}
int AddParts (bins& numParts)
{
for (int i=0; i < myParts; i++)
{
cout << "How many parts would you like to add? ";
cin >> add;
add_part = description.numParts[i] + add;
cout << "Bin " << bin << " now has: " << add_part << endl;
}
}
int RemoveParts (bins& numParts)
{
for (int i=0; i < myParts; i++)
{
cout << "How many parts would you like to remove? ";
cin >> sub;
sub_part = description[i].numParts - sub;
}
}
|