Newbie question: rounding numbers
Hi all, I'm fairly new to the C language and I'm having issues with rounding numbers.
I'm writing a program that asks the user to input a number (this number is a variable of type double).
The user can obviously enter any number, for example, 14.45675. What I'm trying to do is to get that number and round it off to two decimals (so it will be 14.46) to proceed with further calculations that are related with dollars/cents (hence the reason why I only want two decimal places).
In other words, I'm trying to round the number to two decimals and 'chop off' the rest of the decimals so they don't interfere later on with my calculations.
I hope this is clear enough.
Thanks in advance.