Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 25, 2019 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/976a54a666e6bcec68553c13967794e2 to your computer and use it in GitHub Desktop.
Save jasongorman/976a54a666e6bcec68553c13967794e2 to your computer and use it in GitHub Desktop.
float area(const struct Room *room) {
return room->length * room->width;
}
float price(const struct Carpet *carpet, float area) {
if(carpet->roundUp){
area = ceil(area);
}
return area * carpet->pricePerSqrMetre;
}
float quote(struct Room *room, struct Carpet *carpet){
return price(carpet, area(room));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment