I use double for decimal numbers: double price; cin >> price; reads values like 19.99, 0.5, or -3.14. The extraction handles both integer notation and scientific notation like 1.5e2 for 150.
If the user types 19.99, the value stores as a floating-point approximation. If they type 20, it converts to 20.0 automatically. The extraction stops at whitespace or invalid characters.
When reading multiple decimals, separate them with spaces or newlines: double a, b; cin >> a >> b; reads 3.14 2.71 successfully. If the user types 3.14abc, the abc remains in the buffer.