I have this piece of code which ensures that the user inputs a N-digit Number(With no leading zeroes). I am new to C++ but I feel the approach is correct. Please correct if anything is amiss.
#include <iostream>
#include <string>
#include <cmath>
std::string get_input(int n) {
    std::string guess;
    do
    {
        std::cout << "Enter a " << n << "-digit Number: ";
        std::cin >> guess;
    } while( (guess.length() != n) && (std::stoi(guess) / std::pow(10,n) == 0) );
    return guess; 
}
int main() {
    int n {};
    std::cout << "Enter N: ";
    std::cin >> n;
    std::string guess{get_input(n)};
    return 0; 
}
This program is accepting any length string(number). Which part of the solution seems wrong?
PS: I use C++17(--std=c++17)
Edit: Add execution example

 
     
    