I am building a program which accepts a number between 5 and 95 and sorts that number into change of 50-20-10 and 5 cent pieces.
It has the errors:
line 3- ) expected
line 6- unterminated string or character constant.
I am confused on how to fix these errors.
Code:
#include <stdio.h>
int takenum(int &num)
{
printf("Please input change:");
scanf("%d%*c", &num");
return(num);
}
int calc(int num, int fifty, int twenty, int ten, int five)
{
while(num >= 5 && num <= 95)
{
if(num >= 50)
{
fifty++;
num-=50;
}
else
if(num >= 20)
{
twenty++;
num-=20;
}
else
if(num >= 10)
{
ten++;
num-=10;
}
else
if(num >= 5)
{
five++;
num-=5;
}
}
return(fifty, twenty, ten, five);
}
void print(int fifty, int twenty, int ten, int five)
{
printf("Number of 50 cents %d", fifty);
printf("Number of 20 cents %d", twenty);
printf("Number of 10 cents %d", ten);
printf("Number of 5 cents %d", five);
}
int main()
{
int takenum(int num);
int calc(int num, int fifty, int twenty, int ten, int five);
void print(int fifty, int twenty, int ten, int five);
return(0);
}