Question: Write a complete C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars)
Write a complete C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this amount using the least number of bills. The bills dispenses are 50s, 20s, and 10s. Write a function that determines how many of each kind of bill to dispense.
When writing your function begin to pass your variables using pointers (or rather "pointing" to your data". Use the TimeSpace program example attached as you need to.
#includevoid timer(int,int *,int *,int *); // * pointer, capable of holding an address void print_results(int,int,int,int); void explanation(); int main() { int total_secs,hours,minutes,seconds; explanation(); printf("How may total seconds to convert? "); scanf("%d",&total_secs); timer(total_secs,&hours,&minutes,&seconds);//& indicates address of print_results(total_secs,hours,minutes,seconds); return 0; } void print_results(int ts, int h, int m, int s) { printf("Total Seconds Entered: %8d ",ts); printf("Hours : %8d ",h); printf("Minutes : %8d ",m); printf("Seconds : %8d ",s); } void timer(int ts,int *h,int *m, int *s)//* indicates a variable than hold an address { *h=ts/3600; ts=ts%3600; *m=ts/60; ts=ts%60; *s=ts; } void explanation() { printf("Give me a total number of seconds "); printf("and I will tell you how many "); printf("hours, minutes, and seconds it is. "); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
