I believe you're trying to do one of these two things (or probably both).
To cast the result of the expression a * 100
to float
.
To pass the expression a * 100
to roundf()
assuming that it expects a float
as an argument.
If you're trying to cast a value to float
, then the correct syntax for doing this is
(float)value;
For example
int x = 10;
float f = (float)x; // cast the value in x to float
If rather you're passing the expression to roundf()
, then you don't really need to include the datatype. Just the variable name/the value/the expression.
For example
float f = 10.5;
float r0 = roundf(f); // passing a variable
float r1 = roundf(9.3); // passing a value
float r2 = roundf(5.2 * 100); //passing an expression
That's a thing! Another thing is that you should be printing a newline and a white space before "O hai! How much change is owed?". And probably you should use GetFloat()
from the CS50 library since it guarantees that you'll get a float
as input from the user.