fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. struct inventory {
  7. string partName;
  8. int numPart;
  9. };
  10.  
  11. void addInventory (int )
  12.  
  13. int main() {
  14. int operationSelect;
  15. int menuSelect;
  16. int delta;
  17. const int SIZE = 10;
  18. int binNum;
  19. inventory binList [SIZE] = {{"Valve", 10},{"bearing", 5},{"Bushing", 15},
  20. {"Coupling", 21},{"Flange", 7},{"Gear", 5},
  21. {"Gear Housing", 5},{"Vacuum Gripper", 25},
  22. {"Cable", 18},{"Rod", 12}};
  23.  
  24. do{
  25. cout << left << "Bin #: ";
  26. cout << "Description: ";
  27. cout << "Quantity: " << endl;
  28. for (int i = 0; i < SIZE; i++){
  29. cout << left << setw(7) << i + 1 << " " << setw(14);
  30. cout << binList [i].partName << " ";
  31. cout << binList[i].numPart << endl;
  32. }
  33. cout << "select bin (enter 0 to quit)" << endl;
  34. cin >> menuSelect;
  35. if (menuSelect > 0) {
  36. binNum = menuSelect - 1;
  37. cout << "Enter 1 to increase quantity. ";
  38. cout << "Enter 2 to decrease quantity: ";
  39. cout << endl;
  40. cin >> operationSelect;
  41. if (operationSelect == 1){
  42. cout << "Enter quantity to increase: " << endl;
  43. cin >> delta;
  44. addInventory();
  45. }
  46. else{
  47. cout << "Enter quantity to decrease" << endl;
  48. cin >> delta;
  49. minusInventory;
  50. }
  51. }
  52. } while (menuSelect != 0);
  53. return 0;
  54. }
  55.  
  56.  
  57.  
  58.  
Compilation error #stdin compilation error #stdout 0.01s 5316KB
stdin
9
2
4
0
compilation info
prog.cpp:11:31: error: ‘binList’ has not been declared
 int addInventory (int binNum, binList[] ,inventory ,int delta);
                               ^~~~~~~
prog.cpp:12:33: error: ‘binList’ has not been declared
 int minusInventory (int binNum, binList[] ,inventory ,int delta);
                                 ^~~~~~~
prog.cpp:57:19: error: ‘int addInventory’ redeclared as different kind of symbol
 int addInventory (binList[binNum], inventory ,int delta){
                   ^~~~~~~
prog.cpp:11:5: note: previous declaration ‘int addInventory(int, int*, inventory, int)’
 int addInventory (int binNum, binList[] ,inventory ,int delta);
     ^~~~~~~~~~~~
prog.cpp:57:19: error: ‘binList’ was not declared in this scope
 int addInventory (binList[binNum], inventory ,int delta){
                   ^~~~~~~
prog.cpp:57:27: error: ‘binNum’ was not declared in this scope
 int addInventory (binList[binNum], inventory ,int delta){
                           ^~~~~~
prog.cpp:57:27: note: suggested alternative: ‘linux’
 int addInventory (binList[binNum], inventory ,int delta){
                           ^~~~~~
                           linux
prog.cpp:57:46: error: expected primary-expression before ‘,’ token
 int addInventory (binList[binNum], inventory ,int delta){
                                              ^
prog.cpp:57:47: error: expected primary-expression before ‘int’
 int addInventory (binList[binNum], inventory ,int delta){
                                               ^~~
prog.cpp:61:21: error: ‘int minusInventory’ redeclared as different kind of symbol
 int minusInventory (binList[binNum] ,inventory ,int delta){
                     ^~~~~~~
prog.cpp:12:5: note: previous declaration ‘int minusInventory(int, int*, inventory, int)’
 int minusInventory (int binNum, binList[] ,inventory ,int delta);
     ^~~~~~~~~~~~~~
prog.cpp:61:21: error: ‘binList’ was not declared in this scope
 int minusInventory (binList[binNum] ,inventory ,int delta){
                     ^~~~~~~
prog.cpp:61:29: error: ‘binNum’ was not declared in this scope
 int minusInventory (binList[binNum] ,inventory ,int delta){
                             ^~~~~~
prog.cpp:61:29: note: suggested alternative: ‘linux’
 int minusInventory (binList[binNum] ,inventory ,int delta){
                             ^~~~~~
                             linux
prog.cpp:61:48: error: expected primary-expression before ‘,’ token
 int minusInventory (binList[binNum] ,inventory ,int delta){
                                                ^
prog.cpp:61:49: error: expected primary-expression before ‘int’
 int minusInventory (binList[binNum] ,inventory ,int delta){
                                                 ^~~
stdout
Standard output is empty