Anyone have any idea how I would write a program that lets user input a floating point number and then either round up if number is like 4.5 our round down(truncate) if number like 4.49. Any help would be greatly appreciated.
There are several ways that can be done. One way is to add 0.5 (or a similar value depending on where you want to round) to the original value and then cast it to an int and then back again if you want to round to the nearest decimal value place holder.
Use modf() function to splt integer and fractional parts of the double value before other operations (change a sign of negative value before other stuff then restore right sign after rounding). You lost some precision and may catch overflow with direct multiplication. Have a look to addition of 0.5 in Lerner's post (no need in if-else).
Using (twice) of relatively slow pow function is not the best idea. Consider another approach(es)...