All pastes #332808 Raw Edit

Someone

public cpp v1 · immutable
#332808 ·published 2007-01-30 09:16 UTC
rendered paste body
#include <iostream>using namespace std;// Declare constantsconst double NICKEL = 0.05;const double DIME = 0.10;const double QUARTER = 0.25;const double DOLLAR = 1.00;const double TEN = 10;const double FIFTY = 50;const double HUNDRED = 100;int main() {	// initialize amount	double amount = 0;		// ask for input	cout << "Enter an amount: $";	cin >> amount;		// hundred dollar bills	int hundreds = (amount / HUNDRED);	amount -= (hundreds * HUNDRED);		// fifty dollar bills	int fifties = (amount / FIFTY);	amount -= (fifties * FIFTY);		// ten dollar bills	int tens = (amount / TEN);	amount -= (tens * TEN);		// dollars	int dollars = (amount / DOLLAR);	amount -= (dollars * DOLLAR);		// quarters	int quarters = (amount / QUARTER);	amount -= (quarters * QUARTER);		// dimes	int dimes = (amount / DIME);	amount -= (dimes * DIME);		// nickels	int nickels = (amount / NICKEL);	amount -= (nickels * NICKEL);		// remaining is pennies	int pennies = amount * 100;		cout << hundreds << " $100 bills" << endl		<< fifties << " $50 bills" << endl		<< tens << " $10 bills" << endl		<< dollars << " $1 bills" << endl		<< quarters << " quarters" << endl		<< dimes << " dimes" << endl		<< nickels << " nickels" << endl		<< pennies << " pennies" << endl;			return 0;}