I have a problem viewing the number of buildings, provided the height of buildings is 3,5,1,8, 5, 9, 7, 4,4 All the buildings are in one line and the user stands in front of the building with height.
The easiest to solve is to do a search to identify building buildings
- currenthistbuilding = array 1 [x]
- array 2 [y] = current building building
- y =
- End loop
- Print Array2 content (all non-zero values are visible buildings)
- End / Li>
- Termination
Curiosity outside, do you have to think about the angle of view for your question? I do not believe, because no information has been given about the distance of viewers and buildings.
Perception: I think all the buildings are of the same width, they are completely aligned in a straight line, equal intervals and users are dead in front of them.
Edit: If you only need counting
- Start
- Create an array and load the building heights in it [Array1] < Announce the variable and start CurrentHighestbuilding = 0, count = 0
- for each item in the Array1 loop
- If Array1 [x]> Current Highlight Building
- Ul>
- / li>
- Print number
- Termination
- If Array1 [x]> Current Highlight Building
No comments:
Post a Comment