Calculate the continued fraction using the function indicators
Don't use using namespace std 
Prefer prefix over postfix
return 0 is not needed at the end of main
Prefer using \n over std::endl
Don't use printf in C++ code
As Reinderien already mentioned the exit variable is not needed. I.e.

for (;;) {
        // [...]
        if (n == 0) {
            break;
        }
        // [...]


will be sufficient.