Write a function that converts an input of some integer number of nickels into o
ID: 3570833 • Letter: W
Question
Write a function that converts an input of some integer number of nickels into outputs of integer numbers of dollars, quarters, and nickels. Do not write a main function. Your function does not do cin or cout. Your function will have four parameters. Make sure you use appropriate parameter passing techniques! Your function will be a void function. There are 5 nickels in a quarter, and 20 nickels in a dollar. For example, if the total number of nickels input is 27, the results are 1 dollar, 1 quarter, and 2 nickels
Explanation / Answer
#include using namespace std; int main () { int dollars; int quarters; int dimes; int nickels; int pennies; // these are the variables std::cout dollars; std::cout (quarters + dimes + nickels + pennies); // should be placing amounts given int numberofquar = (quarters + dimes + nickels + pennies) /20 int numberofdimes = ((quarters + dimes + nickels + pennies) / 20) / 10; int numberofnick = (((quarters + dimes + nickels + pennies) / 20) / 10) / 5; int numberofpenny = ((((quarters + dimes + nickels + pennies) / 20) / 10) / 5) / 1; int numberofdollar = dollars; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.