THIS IS MY QUESTION, WRITE A CODE IN C++ 12.1 Change Calculator Write a program that calculates number of coins for a given positive cash
THIS IS MY QUESTION, WRITE A CODE IN C++
12.1 Change Calculator
Write a program that calculates number of coins for a given positive cash amount in pennies. So if you input 59, then the output would look like:
59 has 2 quarters, 0 dimes, 1 nickels, 4 pennies
A template has been provided for you
AND THIS IS MY CODE:
#include
{ while(amount_left >= coin_value) { num++; amount_left -= coin_value; } } int main() { int amount_left; int quarters = 0, dimes = 0, nickels = 0; while(true) { printf("Enter number of cents (or zero to quit): "); cin>>amount_left; if(amount_left 99) { cout
WHEN I SUBMIT IT INTO ZYBOOK, I GOT 0 POINT, AND I DONT KNOW WHERE IS THE PROBLEM.
PLEASE HELP ME FIX IT.
THANK YOU!!
Only show failing tests Download this submission 1: Compare outputA 0/5 Program generated too much output. Output rostricted to 50000 characters. Check program for any unterminated loops generating output. Input 59 Enter number of cents (or zero to quit): 59 cents can be given as 2 quar Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cent.s can be given as 4 penni Entor number of cents for zero to quit): 4 cents can be given as 4 penni ntor number of cents (or zero to quit): 4 cents can be given as 4 ponni Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 1 penni Enter number of cents (or zero to quit): 4 cents can be given as 1 pen nter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penn Enter number of cents (or zero to quit): 4 cents can be given as 1 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penni Enter number of cents (or zero to quit): 4 cents can be given as 4 penn Enter number of cents (or zero to quit): 4 cents can be given as 4 penni
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started