I am new to this and experiencing some problems. I am trying to create a converter where i type in a dollar amount and it will return the amount of quarters, dimes, nickles, or pennies that it would take to make that dollar amount
This is a discussion on having problems within the C++ Programming forums, part of the General Programming Boards category; I am new to this and experiencing some problems. I am trying to create a converter where i type in ...
I am new to this and experiencing some problems. I am trying to create a converter where i type in a dollar amount and it will return the amount of quarters, dimes, nickles, or pennies that it would take to make that dollar amount
So, what is your question?
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Im not getting an amount as an output. When I enter a dollar amount $1 and choose to convert it to change, example pennies, the output is 011.
basically it doesn't convert $1 to 100 pennies or 4 quarters
I need help. If somebody could look at the code and tell me where I am going wrong.
In the following snippet from main()
When a program encounters a return statement it "returns" from the function without executing any code following the return. Since this is from main() the program ends without doing anything else.Code:{ if ( money < 1 ) // if dollar amount if 1 or less end loop return -1; else if ( choice == 1 ) // if user types 1 then return total = (money * ( PENNY * 100 )); // total pennies else if ( choice == 2 ) // if user types 2 then return ( money = ( DIME * 10)) ; // total dimes else if ( choice == 3 ) // if user types 3 then return ( money = ( QUARTER * 4)); // total quarters else if ( choice == 4 ) //if user types quarter return ( money = ( NICKEL * 20 )); // nickles }
In future please post your code in the post (contained in code tags) not as an attachment.
Jim