Electrical and Computer Engineering
51 of 52
UAH
CPE 112
Yet More ConePaint
•       float redCost;         // Cost to paint a cone red
•    float blueCost;       // Cost to paint a cone blue
•    float greenCost;      // Cost to paint a cone green
•
•    cout << fixed << showpoint;      // Set up floating-pt.
•                                     //   output format
•
•    // Convert dimensions to feet
•    heightInFt = HT_IN_INCHES / INCHES_PER_FT;
•    diamInFt = DIAM_IN_INCHES / INCHES_PER_FT;
•    radius = diamInFt / 2.0;
•
•    // Compute surface area of the cone
•    surfaceArea = PI * radius *
•                  sqrt(radius*radius + heightInFt*heightInFt);
•