Question
Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would
Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:
// main module
Module main()
// Local variables
Declare Integer pennies, nickels, dimes, quarters
Declare Real money
// Get the number of coins.
Call getCoins(pennies, nickels, dimes, quarters)
// Calculate the amount of money.
Set money = pennies * 0.01 + nickels * 0.05 +
dimes * 0.10 + quarters * 0.25
If money == 1.00 Then
Display "$1.00 exactly! You won the game!"
Else If money < 1.00 Then
Display "Sorry, that is less than $1.00."
Else
Display "Sorry, that is more than $1.00."
End If
End Module
// The getCoins module prompts the user to enter the number
// of pennies, nickels, dimes, and quarters. The input is
// stored in the reference arguments.
Module getCoins(Integer Ref pennies, Integer Ref nickels,
Integer Ref dimes, Integer Ref quarters)
// Get the number of pennies.
Display "Enter the number of pennies."
Input pennies
// Get the number of nickels.
Display "Enter the number of nickels."
Input nickels
// Get the number of dimes.
Display "Enter the number of dimes."
Input dimes
// Get the number of quarters.
Display "Enter the number of quarters."
Input quarters
End Module
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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