fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. using namespace std;
  5.  
  6. struct Inventory {
  7. string description; //Description of the part kept in the bin
  8. int total; //Number of parts in the bin
  9. };
  10.  
  11. struct Inventory bins[30];
  12.  
  13. void DisplayInventory(int count){
  14. for (int i = 0; i < count; ++i)
  15. {
  16. cout << setw(18) << left << setfill('.') << bins[i].description << setw(5) << right << setfill('*') << bins[i].total << endl;
  17. }
  18. cout << endl;
  19. }
  20.  
  21. int main()
  22. {
  23. bins[0].description = "Valve";
  24. bins[0].total = 10;
  25. bins[1].description = "Bearing";
  26. bins[1].total = 5;
  27. bins[2].description = "Bushing";
  28. bins[2].total = 15;
  29. bins[3].description = "Coupling";
  30. bins[3].total = 21;
  31. bins[4].description = "Flange";
  32. bins[4].total = 7;
  33. bins[5].description = "Gear";
  34. bins[5].total = 5;
  35. bins[6].description = "Gear Housing";
  36. bins[6].total = 5;
  37. bins[7].description = "Vacuum Gripper";
  38. bins[7].total = 25;
  39. bins[8].description = "Cable";
  40. bins[8].total = 18;
  41. bins[9].description = "Rod";
  42. bins[9].total = 12;
  43.  
  44. DisplayInventory(10);
  45. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Valve.............***10
Bearing...........****5
Bushing...........***15
Coupling..........***21
Flange............****7
Gear..............****5
Gear Housing......****5
Vacuum Gripper....***25
Cable.............***18
Rod...............***12