Hi am trying to make a small money maker game, where the user enters an amount of coins and then gets the number of cents, pennies etc based on the amount the user inputs.
Now if the user puts in a fractional number i have made the console round down with the Math.Floor()
method.
But i am thinking it is better to make an if statement where this only happens if the user inputs .5 and down, and rounds up if the user inputs .6 and up.
Do i now use the Contains()
method and a or operator: ||
to achieve this? Is this a bad way to do it?
The reason i am asking about this is because i want to learn.
Aucun commentaire:
Enregistrer un commentaire