Create a room structure (C-style, no member-functions) with member-data room dimensions. Write a show () function that displays the room data and an area () function that calculates its face (squaring).
In main () create a static array of rooms (Room variables) - the rooms in one apartment. For each of the rooms, display its dimensions and square footage. Determine the total square footage of the apartment.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <string>
usingnamespace std;
struct room {
double l ;
double h;
};
void show (room);
1. Create a room structure (C-style, no member-functions) with member-data room dimensions.
2. Write a show () function that displays the room data
2a. and an area () function that calculates its face (squaring).
3. In main () create a static array of rooms (Room variables) - the rooms in one apartment.
4. For each of the rooms, display its dimensions and square footage.
5. Determine the total square footage of the apartment.
A good name that describes the variable or function is very helpful.
I would suggest working on the program in small parts. First get the input to put into the array then store the information. A good question is do you want a 1D array or a 2D array? Point 3 does not say what the array should be, so you could choose a 2D array that would be acceptable.
I like to get some of the easier parts coded first. Esepically when it comes to getting user input so that you have something to work with. Then the rest becomes easier to work out.
It is also a good idea to have some plan to work from. It makes the coding easier.