Home Forums Re: ATM

#3335
Humayan
Participant

Heres some example code ( this is an algorithm I adapted from “Data structures and Problem Solving Using C++” by Mark Allen West ). The code is in C++ , but you can adapt it ( I like to program most things in C++ , but without the use of OPP ). Anyway , heres the code:

and heres some output examples:

enter an amount 88

The number of bills needed to change 88 is 7
The bills used are:
one dollar
one dollar
one dollar
one five
one ten
one twenty
one fifty
Press any key to continue
enter an amount 77

The number of bills needed to change 77 is 5
The bills used are:
one dollar
one dollar
one five
one twenty
one fifty
Press any key to continue

sorry for the alignment , this forum messes up my tabing….