Hello,

I coded this program today for an intro C++ class, works great and all that good stuff I just had a question maybe someone can help with.

The teacher says we must use real number objects that identify price,payment, and change.

My question is did I do this already or am I missing the concept, or have I missed it completely ?

Any help is appreciated, if I am asking for to much information without putting enough into my source I am sorry.

Thank you in advance...

Code:
/* 
	Program Description:This Program operates as a Cash Register.
	User enters amount of purchase, then enters amount paid toward
	purchase. Change to return to user is calculated as well as
	number of returned coins are counted. All information is formatted
	and output to user.
*/

//	system defined preprocessor statement for cin/cout operations
#include < iostream.h > 

//	programmer defined preprocessor statement for setreal operation 
#include "textlib.h" 

//	system defined preprocessor statement for set width operation
#include <iomanip.h>

int main( ) 
{ 
	// comment constant object above the code 
	const int QUARTERS = 25;
	//
	const int DIMES = 10;
	//
	const int NICKELS = 5;
	//
	const int PENNIES = 1;

	// comment object above the code 
	double change;
	//
	double price;
	//
	double payment;
	
	//
	int coinChange;
	//
	int dollars;
	//
	int quarterChange;
	//
	int dimeChange;
	//
	int nickelChange;
	//
	int pennyChange;
	
	cout << "Enter the purchase total $: ";
	cin  >> price;
	cout << "Enter the payment $: ";
	cin  >> payment;

	// comment calculations 
	change = payment - price;

	//
	dollars = int(change);

	//
	coinChange = (int((change-dollars)*100));

	//
	quarterChange = coinChange/QUARTERS;
	coinChange -= (quarterChange*QUARTERS);

	//
	dimeChange = coinChange/DIMES;
	coinChange -= (dimeChange*DIMES);

	//
	nickelChange = coinChange/NICKELS;
	coinChange -= (nickelChange*NICKELS);

	//
	pennyChange = coinChange/PENNIES;
	
	cout << "Purchase Total" << setw(7) << price << setreal(1,2) << endl;
	cout << "Payment" << setw(14) << payment << setreal(1,2) << endl;
	cout << "Change" << setw(15) << change << setreal(1,2) << endl;
	cout << "Dollars" << setw(14) << dollars << setreal(1,0) << endl;
	cout << "Quarters" << setw(13) << quarterChange << setreal(1,1) << endl;
	cout << "Dimes" << setw(16) << dimeChange << setreal(1,1) << endl;
	cout << "Nickels" << setw(14) << nickelChange << setreal(1,1) << endl;
	cout << "Pennies" << setw(14) << pennyChange << setreal(1,1) << endl;

	return 0; 
}