Skip to content

C++ console app to compute Cp/Cpk capability indices from text/CSV.

License

Notifications You must be signed in to change notification settings

codemark1210/cpk-calculator

Repository files navigation

Cp/Cpk Capability Calculator (C++)

Small C++ console app that computes Cp/Cpk capability indices from a 1-column text/CSV file.

Repo: codemark1210/cpktest • Toolchain: MSVC / Visual Studio 2022 • License: MIT

Why

In SPC/quality work you often need a quick, offline check of process capability. This tool prints n, mean, sd, Cp, Cpu/Cpl, Cpk from a measurement list.

Features

  • CLI: --file <path> --lsl <num> --usl <num>
  • Tolerates comma-separated lines
  • Clear error messages (bad path, invalid limits, too few samples)
  • Builds with Visual Studio (MSBuild); also works with GCC/Clang

Build & Run (Visual Studio)

  1. Open the solution cpktest.sln.
  2. Set Platform = x64, Configuration = Debug/Release.
  3. Project → PropertiesDebugging
    • Working Directory: $(ProjectDir)
    • Command Arguments:
      --file "$(ProjectDir)example_values.txt" --lsl 9.7 --usl 10.3
      
  4. Run (Ctrl+F5). You should see an output like:
n                : 10
mean             : 10.0900
sd               : 0.0252
LSL              : 9.7000
USL              : 10.3000
Cp               : 1.9841
Cpu              : 2.7718
Cpl              : 1.5397
Cpk              : 1.5397
Capability grade : Good

File Format

example_values.txt (one value per line). Commas in a line are tolerated.

Theory (short)

$$ Cp = \frac{USL - LSL}{6\sigma} $$

$$ Cpk = \min!\left(\frac{USL - \mu}{3\sigma},, \frac{\mu - LSL}{3\sigma}\right) $$

Rules of thumb. Cpk < 1.0 (poor), 1.0–1.33 (marginal), 1.33–1.67 (good), ≥ 1.67 (excellent).

Roadmap

  • --target / --tolerance argument pair
  • CSV column selection
  • Markdown report export
  • Within-sigma (subgroup) option

License

MIT © 2025 codemark1210

About

C++ console app to compute Cp/Cpk capability indices from text/CSV.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages