Question: Anyone can check my code? :( I'm learning C++ online by myself as a beginner, I just tried to solve a problem, it can run,

Anyone can check my code? :(

I'm learning C++ online by myself as a beginner,

I just tried to solve a problem, it can run, but the result is always wrong (I'm sad), the first picture has the requirements of this problem.

please give me suggestions and reasons (For example, why did I do something wrong? What kind of thinking should I follow) ! Thanks!

Anyone can check my code? :( I'm learning C++ online by myself

as a beginner, I just tried to solve a problem, it can

********** 1- /* 2 Write a program that asks the user to enter a number of quarters, dimes, nickels and pennies 3 and then outputs the monetary value of the coins in the format of dollars and remaining cents. 4. Your program should interact with the user exactly as it shows in the following example: 5 6 Please enter the number of coins: 7 # of quarters: 20 8 # of dimes: 4 9 # of nickels: 13 10 # of pennies: 17 11 The total is 6 dollars and 22 cents 12 13 ********* 14 15 #include 16 #include 17 using namespace std; 18 19 int main() 20 { 21 int quarters, dimes, nickels, sum, dollars, One_dollar, total_dollars, cents, remainingCents; 22 int pennies; 23 cout > quarters; 26 cout > dimes; 28 cout > dimes; cout > nickels; cout > pennies; 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 } 47 One_dollar = 0.01 * cents; pennies = One_dollar * 0.01; quarters = 0.25 * One_dollar; dimes = 0.1 * One_dollar; nickels = 0.05 * One_dollar; sum = (quarters + dimes + nickels + pennies); total_dollars = sum / One_dollar; remainingCents = sum % One_dollar; cout

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!