All pastes #334049 Raw Edit

Anonymous

public cpp v1 · immutable
#334049 ·published 2007-01-31 09:55 UTC
rendered paste body
// A program that asks the user for a dollar amount.  The program then determines and // displays the fewest number of each bill and coin needed to total the amount entered.// Source filename: Lab1.cpp// Written by:  Chieh-Yuan Tien#include <iostream>using namespace std;int main(){	double totalDollar, showtotal; // The total amount of money user has entered	double tens = 10000;  // ten dollar bills	double fives = 500;  // five dollar bills	double ones = 100;  // one dollar bills	double quarters = 25;  // quarters	double dimes = 10;  // dime	double nickels = 5;  // nickle	double pennies = 1;  // penny	int shows;		// Get the total amount of money from the user	cout << "Please enter the amount of $ including cents ( xxxxx.xx ): ";	cin >> totalDollar;		// take the amount and convert it in terms of pennies	totalDollar = totalDollar * 100;	// Calculation to determines the fewest number of each bill and coin needed to total the amount entered	shows = totalDollar / tens;	totalDollar = totalDollar - shows*tens;	cout << shows <<" ten dollar bills" << endl;	shows = totalDollar / fives;	totalDollar = totalDollar - shows*fives;	cout << shows <<" five dollar bills" << endl;	shows = totalDollar / ones;	totalDollar = totalDollar - shows*ones;	cout << shows <<" one dollar bills" << endl;	shows = totalDollar / quarters;	totalDollar = totalDollar - shows*quarters;	cout << shows <<" quarters" << endl;	shows = totalDollar / dimes;	totalDollar = totalDollar - shows*dimes;	cout << shows <<" dimes" << endl;	shows = totalDollar / nickels;	totalDollar = totalDollar - shows*nickels;	cout << shows <<" nickels" << endl;	shows = totalDollar;	cout << shows <<" pennies" << endl;		// Display the result/*	cout << endl;	cout << tens <<" ten dollar bills" << endl;	cout << fives <<" five dollar bills" << endl;	cout << ones <<" one dollar bills" << endl;	cout << quarters <<" quarters" << endl;	cout << dimes <<" dimes" << endl;	cout << nickels <<" nickels" << endl;	cout << pennies <<" pennies" << endl;	cout << endl;	cout << "Total: $" << showtotal << endl;	cout << endl;	*/	return 0;}