// FILE: Coins.cpp // DETERMINES THE VALUE OF A COIN COLLECTION #include #include "apstring.h" int main () { // Local data ... apstring name; // input: sisterŐs first name int pennies; // input: count of pennies int nickels; // input: count of nickels int dollars; // output: value of coins in dollars int change; // output: value of coins in cents int total_cents; // total cents represented // Prompt sister for name. cout << "Enter your first name and press return: "; cin >> name; // Read in the count of nickels and pennies. cout << "Enter the number of nickels and press return: "; cin >> nickels; cout << "Enter the number of pennies and press return: "; cin >> pennies; // Compute the total value in cents. total_cents = 5 * nickels + pennies; // Find the value in dollars and change. dollars = total_cents / 100; change = total_cents % 100; // Display the value in dollars and change. cout << "Good work " << name << '!' << endl; cout << "Your collection is worth " << dollars << " dollars and " << change << " cents." << endl; return 0; }