Very strange C++ behavior

I have just faced this when I was trying the interactive problem Guessing Game. So without asking anything related to contest- We have to take input of a character after each query. So I used scanf("%c",&c) for input. Now when I run my program, it prints the output twice. But when I use cin>>c, it prints as it should have.
Why does C++17 show this weird behavior or am I missing something?