EDIT - I changed a few things, and now I'm getting the error message below for line 49. Still needing some assistance to understand! I pasted the entire code below.
I'm working on CS50 Problem Set 1, the Cash problem. I need some help understanding the error I'm getting for the printf function on line 52. Can anyone help me understand what it means by, "expected expression" in this context? TIA!
#include <cs50.h>
#include <stdio.h>
int calculate_quarters(int cents);
int calculate_dimes(int cents);
int calculate_nickels(int nickels);
int calculate_pennies(int pennies);
int add(int a, int b, int c, int d);
int main(void)
{
//prompt use for changed owed, in cents
int cents;
do
{
cents = get_int("Change owed: ");
}
while (cents < 0);
//calculate how many quarters you should give the customer
int calculate_quarters(int cents);
int quarters = 0;
//subtract the value of those quarters from cents
cents = cents - (quarters * 25);
//calculate how many dimes you should give the customer
int calculate_dimes(int cents);
int dimes = 0;
//subtract the value of those dimes from remaining cents
cents = cents - (dimes * 10);
//calculate how many nickels you should give the customer
int calculate_nickels(int nickels);
int nickels = 0;
//subtract the value of those nickels from remaining cents
cents = cents - (nickels * 5);
//calculate how many pennies you should give the customer
int calculate_pennies(int pennies);
int pennies = 0;
//subtract the value of those pennies from remaining cents
cents = cents - pennies;
//sum the number of quarters, dimes, nickels and pennies used
int answer = int add(quarters, dimes, nickels, pennies);
//print that sum
printf("%i\n", int answer);
}
int calculate_quarters(int cents)
{
//calculate how many quarters you should give the customer
int quarters = 0;
while (cents >= 25)
{
quarters++;
cents = cents - 25;
}
return quarters;
}
int calculate_dimes(int cents)
{
int dimes = 0;
while (cents >= 10)
{
dimes++;
cents = cents - 10;
}
return dimes;
}
int calculate_nickels(int nickels)
{
int nickels = 0;
while (cents >= 5)
{
nickels++;
cents = cents - 5;
}
return nickels;
}
int calculate_pennies(int pennies)
{
int pennies = 0;
while (cents >= 1)
{
pennies++;
cents = cents -1;
}
return pennies;
}
int add(int a, int b, int c, int d)
{
return a + b + c + d;
}