Projects Inventory

Simulation of Quality Control in Manufacturing Gaming Project in C++

Explanation

  1. Function qualityControlCheck(int batchSize, double defectRate):
    • Purpose: Simulates the quality control check for a batch of items.
    • Advertisement
    • Parameters:
      • batchSize: The number of items in the batch.
      • defectRate: The probability of an item being defective.
    • Implementation:
      • Iterates through each item in the batch.
      • Advertisement
      • Uses a random number to determine if an item is defective based on the defectRate.
      • Counts and returns the number of defective items.
  2. Main Function:
    • Setup:
      • Seeds the random number generator for simulating the defect checks.
      • Prompts the user for the batch size and defect rate.
      • Validates that the defect rate is within the range [0, 1].
    • Simulation:
      • Calls qualityControlCheck to determine the number of defective items.
      • Outputs batch size, defect rate, number of defective items, and percentage of defective items.
      • Advertisement

Usage

Exit mobile version