Yesterday, I answered a question about C++ input with an answer that described the very common problem of mixing cin >>
and getline
in the same program and the confusion that ensues.
Three hours later, I found another question which was a result of exactly the same problem and had the same answer. So I copied my answer from the previous question.
Moderator ChrisF just deleted my first answer with a remark about closing as a duplicate:
If you think you've found a duplicate question please vote to close it rather than posting identical answers. – ChrisF♦ 15 mins ago
However, these questions were asked in an entirely different way - I do not believe that they are duplicates. (Believe me, I'm quite happy to close questions as duplicate when appropriate.)
I have to assume that my answer was flagged by some automated duplicate answer checker, as it seems pretty unlikely that ChrisF would notice that otherwise.
What would have been the correct course of action here? Is it really forbidden to post the same answer to different questions? Should I have reworded the answer to use different words, even though it needed to say the same thing? Would marking these questions as duplicates really have helped the OPs?