I think I have figured out a way to convert the users input from dollars to cents. I used the eprintf function and it works. However, when re-watching Zamyla's walk through she mentions towards the end of the conversion section that we need to be careful about floating point imprecision and the output needs to be rounded off. So, I ran an unrealistic value of 1.039 and expected to get 104 but instead got 103. I browsed through Lecture 1 and couldn't find where he covered rounding, though I might have glanced over it. I did find where he talked about changing floating points though.
How do I get the program to round correctly?
//Program to give the most efficient amount of coins when returning change
#include <stdio.h>
#include <cs50.h>
//Prompt user for a positive dollar amount
int main(void)
{
float dollars;
do
{
dollars = get_float("Enter dollar amount:");
}
while(dollars<0);
//convert dollars to cents
int cents;
{
cents = (dollars * 100);
eprintf("%i\n", cents);
}
}