Created
May 5, 2019 11:28
-
-
Save jasongorman/95d320382fb0e28b5b96dde008ed2dba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include "room_area.h" | |
#include "floor_level.h" | |
struct Room { | |
char level; | |
float width; | |
float length; | |
}; | |
Room* new_room(float width, float length, char level){ | |
Room* room = malloc(sizeof(Room)); | |
room->level = level; | |
room->width = width; | |
room->length = length; | |
return room; | |
} | |
float area(Room *room) { | |
return room->length * room->width; | |
} | |
int flightsOfStairs(Room *room){ | |
if(room->level == 'G'){ | |
return 0; | |
} | |
if(room->level == 'B'){ | |
return -1; | |
} | |
return room->level - '0'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment