Convert Array into a primative method to express the same result, using no LINQ only int.

前端 未结 4 408
萌比男神i
萌比男神i 2021-01-27 10:39

my program records the number of bottles four rooms has collected in a bottle drive. When the user types in quit, the number of bottle each room has collected is shown as well a

4条回答
  •  半阙折子戏
    2021-01-27 11:31

    I think your logic is sound (ie using a variable for the max value and max room and comparing each time). Were there any restriction as to not using arrays? It would seem that using 4 variables would require more lines of code.

    I like the answer using a class. But you could very well do this with standard c with an array.

    What is the requirement? encapsulation? robustness?

提交回复
热议问题