OK this is strange, you are using all C in your project.
Are you supposed to do that? This is C++, so...
You are reading with scanf in a very unsafe way, but you could easily fix that by using the "correct" C++ model instead.
Or are you going to keep on using C? I'm wondering here...