Here are 3 options
Type A , to Add parts
Type R , to Remove parts
Type E, to Exit Program
Choose your option: a
You will now add
Which part?
How much do you want to add?
Press any key to continue . . .
how can the user input for example "Cable" and then input to add two more, and display the whole menu, and the updated list? Heres my code, and i also need to pass it through a function. Thanks in advance!
#include <iostream>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <cstring>
using namespace std;
//define Structure as invParts
struct invParts{
int main()
{
invParts bin[10]= { {"valve",10}, {"Bearing",5}, {"Bushing",21},
{"Coupling",7}, {"Flange",5}, {"Gear",5},
{"Gear House", 5}, {"Vacuum Gripper", 25},
{"Cable",18}, {"Rod",12}, };
invParts *descrip;
int row = 0;
int col = 0;
int num;
double add;
double rem;
char choice;
cout<<"-----------------------------------------------------" << endl;
cout<<"Part Description" << " " << "Number of parts in the bin" << endl;
cout <<"----------------------------------------------------" << endl;
cout << endl;
for(row = 0; row < 10; row++)
{
cout << setw(11)<< left <<bin[row].name << setw(25) << right << bin[row].qty<< endl;
}
cout << endl;
cout << "Here are 3 options" << endl;
cout << "Type A , to Add parts" << endl;
cout << "Type R , to Remove parts" << endl;
cout << "Type E, to Exit Program" << endl;
cout << "Choose your option: ";
cin >> choice;
cout << endl;
switch (choice)
{
case 'A' :
case 'a' : cout <<"You will now add" << endl;
cout <<"Which part? " << endl;
cout <<"How much do you want to add? "<<endl;
//addparts(descrip, num);
break;
case 'R':
case 'r': cout <<"You will now remove" << endl;
cout <<"Which part? ";
cout <<"How much do you want to remove? ";
// removeparts(descrip,num);
break;
case 'E':
case 'e': cout<<"Now exiting program" << endl;
exit(0);