help me with programing in C only

I suppose to write a program that dispense the change. the amount of paid and amount of due are input from the user. The program determine how many dollars, quarter, dimes, nickels, pennies should be given as change. Use function with 4 output parameter determine the quantity of each kind of coin(quarter, dimes, nickel, pennies)
And this is all i got right now: it's not finish yet and have some error in it to. Can you guy figure out. help me Please. Thank you alot.

#include
#include
#include

/*protype*/
double balance (double amount_paid, double amount_due);
double quarter (double balance, double twenty_five);

void display_result(void);

int main()
{

double amount_paid, amount_due;
double change;
double coin;
double balance;
double twenty_five=25.00;
printf(" Enter the amount need to pay: ");
fflush(stdin);
scanf("%lf", &amount_paid);
printf(" Enter the amount due: ");
fflush(stdin);
scanf("%lf", &amount_due);

change = balance ( amount_paid, amount_due);

while( change >=100)
{
double coin;
int bills;
change = change - 100;
bills = bills + 1;
}
coin = quarter ( balance, twenty_five);


return 0;
}

double
balance (double amount_paid, double amount_due)
{
return amount_paid - amount_due;
}

double
quarter ( double bal, double twenty_five)
{

double quarters;
double dimes;
double nickels;
double pennies;


if((balance => twenty_five) && (balance <100))
{
balance = balance - twenty_five;
quarters = quarters +1;
}
else if (( balance >= 10) && (balance < twenty_five))
{
balance = balance - 10;
dimes = dimes + 1;
}
else if ((balance >= 5) && (balance < 10))
{
balance = balance - 5;
nickels = nickels +1;
}
else
pennies = balance;

Comments

  • : I suppose to write a program that dispense the change. the amount of paid and amount of due are input from the user. The program determine how many dollars, quarter, dimes, nickels, pennies should be given as change. Use function with 4 output parameter determine the quantity of each kind of coin(quarter, dimes, nickel, pennies)
    : And this is all i got right now: it's not finish yet and have some error in it to. Can you guy figure out. help me Please. Thank you alot.
    :
    : #include
    : #include
    : #include
    :
    : /*protype*/
    : double balance (double amount_paid, double amount_due);
    : double quarter (double balance, double twenty_five);
    :
    : void display_result(void);
    :
    : int main()
    : {
    :
    : double amount_paid, amount_due;
    : double change;
    : double coin;
    : double balance;
    : double twenty_five=25.00;
    : printf(" Enter the amount need to pay: ");
    : fflush(stdin);
    : scanf("%lf", &amount_paid);
    : printf(" Enter the amount due: ");
    : fflush(stdin);
    : scanf("%lf", &amount_due);
    :
    : change = balance ( amount_paid, amount_due);
    :
    : while( change >=100)
    : {
    : double coin;
    : int bills;
    : change = change - 100;
    : bills = bills + 1;
    : }
    : coin = quarter ( balance, twenty_five);
    :
    :
    : return 0;
    : }
    :
    : double
    : balance (double amount_paid, double amount_due)
    : {
    : return amount_paid - amount_due;
    : }
    :
    : double
    : quarter ( double bal, double twenty_five)
    : {
    :
    : double quarters;
    : double dimes;
    : double nickels;
    : double pennies;
    :
    :
    : if((balance => twenty_five) && (balance <100))
    : {
    : balance = balance - twenty_five;
    : quarters = quarters +1;
    : }
    : else if (( balance >= 10) && (balance < twenty_five))
    : {
    : balance = balance - 10;
    : dimes = dimes + 1;
    : }
    : else if ((balance >= 5) && (balance < 10))
    : {
    : balance = balance - 5;
    : nickels = nickels +1;
    : }
    : else
    : pennies = balance;
    :

    dude if this isn't for a class or somthin like that just skip the rest of C and go to C++
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion