Consider a real estate assessment program. Each house has an area in terms of square meter (integer) and a price per square meter (integer).
The given program defines a struct named House with three elements: number, area, and price. (Number is for identifying the houses since you will refer to the houses with these numbers). Then, the program defines an array of houses named: houses, and defines a house named: expensive. Then, it reads an integer N, and then reads the area and price values of N houses from the user. In the meantime, it assigns numbers (starting from 1) to each house.
You should find which of the houses has maximum total price. Then, assign that particular house to the variable: expensive. Finally, the program prints the expensive house to the screen (Currently prints meaningless values because expensive is not initialized yet). The total price of a house is computed by multiplying the area of the house with its price per square meter. For example, for the first sample input/output pair, the total price of the fourth house is 3250 (i.e., 250 * 13).
Assume one of the houses will be more expensive than the others everytime.
NOTE: Your outputs must have exactly the same format with the ones in following examples.
INPUT | OUTPUT |
4 200 12 150 20 300 7 250 13 |
Expensive: Number: 4 Area: 250 Price: 13 |
3 500 50 455 65 600 30 |
Expensive: Number: 2 Area: 455 Price: 65 |
Important issues about all exams/projects/quizzes: