-3
这是我必须为课程编写的代码。我想知道这是否对我之前的其他人有意义,然后再开始学习。我刚开始上课,我想了解我是否走上正轨。硬币计数的伪代码是否正确?
// Declares the Variables
Main module
Declare Quarters As Float
Declare Dimes As Float
Declare Nickels As Float
Declare Pennies As Float
Declare Total_Amount As Float
// This is the name of the Program
Write “Coin Counter”
// This tells the user what the function of the program is
Write “This program will calculate the total value of a group of coins. Assume that the” Write “coins are the standard American coins: penny, nickel, dime, quarter.”
// This calls the sub modules to be executed
Call Input Data module
Call Perform Calculations module
Call Output Results module
// This lets us know that this is the end of the program
End Program
Input Data module
// Get the number of American coins broken down by penny, nickel, dime, quarter.
Write “Enter the number of pennies you want to count.”
Input Pennies
Write “Enter the number of nickels you want to count.”
Input Nickels
Write “Enter the number of dimes you want to count.”
Input Dimes
Write “Enter the number of quarters you want to count.”
Input Quarters
// Sets the value of the coins.
Perform Calculations module
Set Pennies count 1 * 0.01
Set Nickels count 1 * 0.05
Set Dimes count 1 * 0.10
Set Quarters count 1 * 0.25
Set Total_Amount = Quarters + Dimes + Nickels + Pennies
// Displays the value of the change the user entered
Output Results module
Write “The total amount of Pennies is:” + Pennies
Write “The total amount of Nickels is:” + Nickels
Write “The total amount of Dimes is:” + Dimes
Write “The total amount of Quarters is:” + Quarters
// Displays the total of all the coins added together.
Write “The Total: $” + Total_Amount
结果这个问题似乎是题外话,因为它是关于一个代码审查。 –
谢谢你让我知道。我添加了代码审查。 –
1)增加了缩进,它似乎足够易读,除了这个 - “Set Pennies count 1 * 0.01”。我不知道那里发生了什么,尽管我知道它意味着什么。 2)这是关于[so]的主题。代码审查问题更多关于[codereview.se]的主题。更改标签不会改变这一点。 – Dukeling