C++ is a procedural language. Although the line TotalCharge = (mediump * c12in) + (largep * c14in) ; makes sense logically, C++ doesn't "think" like you do. That line needs to be put under the statements that ask for mediump and largep, and before you print TotalCharge. Where that line is now, mediump and largep still have their default values (for numbers that's 0.)