Question: Nickeled and Dimed. Write a program that allows the user to enter a number of quarters, dimes, and nickels and then outputs the monetary value

Nickeled and Dimed. Write a program that allows the user to enter a number of quarters, dimes, and nickels and then outputs the monetary value of the coins in cents. For example, if the user enters 2 for the number of quarters, 3 for the number of dimes, and 1 for the number of nickels, then the program should output that the coins are worth 85 cents.

This is what I have:

#include using namespace std; int main() { int quarters,dimes,nickels,cents; cout << "Enter number of quarters, then dimes, then nickels: " ; cin >> quarters>>dimes>>nickels; cents = quarters*25+dimes*10+nickels* 5; cout << cents; return 0; }

It throws this error:

Given the following was entered from the keyboard: 001 you displayed: Enternumberofquarters,thendimes,thennickels:5 instead of:

Enternumberofquarters,thendims,thennickels:5 (<-What does the arrow mean there?)

What am I doing wrong?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!