C# finding the shortest and longest word in a array

后端 未结 8 1356
小蘑菇
小蘑菇 2021-01-15 04:32

I am trying to find the shortest and longest string value based on length and im getting stuck. As of now the script exits after the writeline. I think the code needs some h

8条回答
  •  渐次进展
    2021-01-15 05:05

    Your for loop condition is always false. i starts at 5 and you are checking for it to be less than 0... This is always false so the loop never starts.

    And if that is just a typo, you are also putting the input into names[i] instead of word[i], and names[i] is never used again...

提交回复
热议问题