Home Forums C Programming Banking Re: Re: Banking

#3486
GWILouisaxwzkla
Participant

Could do this:


/****************************************************************
* File Name : c:programstempcg.cpp
* Date : December,1,2008
* Comments : new project
* Compiler/Assembler :
*
*
*
*
*
* Program Shell Generated At: 2:09:49 p.m.
=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


#include
//#include
//#include
//#include
//#include
//#include

using namespace std;


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@



//##################################################################################


//main function ******************************

int main ( )
{

cout << "Enter change amount : ";
float change;
cin >> change;

int hundreds = 0;
int fifties = 0;
int tens = 0;
int tempChange = change;

while ( tempChange >= 100 )
{
hundreds ++;
tempChange -= 100;
}

tempChange = change;
while ( tempChange >= 50 )
{
fifties ++;
tempChange -= 50;
}

tempChange = change;
while ( tempChange >= 10 )
{
tens ++;
tempChange -= 10;
}

cout << "you can change " << change << " with: " << endl;
cout << hundreds << " hundreds" << endl;
cout << fifties << " fifties " << endl;
cout << tens << " tens" << endl;


return 0 ;
}

output:


Enter change amount : 200
you can change 200 with:
2 hundreds
4 fifties
20 tens
Press any key to continue