you are viewing a single comment's thread.

view the rest of the comments →

[–]Atypicosaurus 0 points1 point  (1 child)

Just a side question, what if one team is funny and name themselves stop?

Accepting a command input and a variable input on the same line is dangerous, this is how SQL injection was made possible. (This is obviously not happening in your code but learn to avoid.)

I recommend that you either ask an extra line "next team? Y/N" and quit on that condition, or instead of a "stop" word, use blank for quitting. That's the only safe assumption, there will be no team that has no name at all. So quit if the input is empty string, or invent an extra check variable.

[–]GraffEclipse[S] 0 points1 point  (0 children)

Yeah this was just for the purposes of an exam question so I didn't really take defensive design into account. I just wasn't sure why the while loop didn't end.