I have writtern this code to ask user to input number of rooms(x) (integer),room area (area(i)) (integer) and room type (string) and based on these selections, Q_env is calculated
This the code
to=input('Enter outside temperature: ');
ti=input('Enter inside temperature: ');
fprintf('ROOM %4.0f:', i)
area(i)=input('Area in meter square = ');
rt=input('Room type: ','s');
The following results are displayed when I run the previous code
Enter outside temperature: 40
Enter inside temperature: 20
No of room: 2
ROOM 1:Area in meter square = 20
Room type: internal
ROOM 2:Area in meter square = 30
Room type: external
Q_env =
279.7200
419.5800
419.5800
There are two problems here:
- rt only saves the last user input and I need all the room types corresponding to each room area to be saved to an array.
- Q_env is diplayed for the given number of rooms and the last result is repeated.
How can I overcome these two issues?