Because it's declared in stdio.h
(cstdio
in C++) header and you haven't included it.
But you shall not use gets
. It's a hopelessly broken function. Use fgets
instead. Even better, ditch the naked pointers to char arrays and use std::string
class instead.