All pastes #334050 Raw Edit

Mine

public cpp v1 · immutable
#334050 ·published 2007-01-31 09:57 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	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;	// the remaining total is the number of pennies	shows = totalDollar;	cout << shows <<" pennies" << endl;