Commit 4f38c552 authored by Alan Marchiori's avatar Alan Marchiori
Browse files

post class

parent 9b49c184
......@@ -18,13 +18,13 @@ struct change *make_change(float amount)
c->pennies = 0;
while (cents > 0){
if (cents > 25){
c->quarters ++;
if (cents >= 25){
c->quarters ++;
cents -= 25;
} else if (cents > 10){
} else if (cents >= 10){
c->dimes ++;
cents -= 10;
} else if (cents > 5){
} else if (cents >= 5){
c->nickels ++;
cents -= 5;
} else{
......
#include <stdio.h> // for printf
struct change {
int quarter;
int dime;
int nickel;
int penny;
};
struct change* make_change(float f)
{
struct change *myChange = calloc(1, sizeof(struct change));
float temp = f;
while (temp > 0){
if (temp >= 0.25){
temp -= 0.25;
myChange->quarter += 1;
} else if (temp >= 0.10){
temp -= 0.10;
myChange->dime += 1;
} else if (temp >= 0.05){
} else {
}
}
}
void print_change(struct change* d)
{
}
int main(void)
{
float amount;
printf("Enter an amount in dollars: ");
scanf("%f",&amount);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment