Convert Octal String to Decimal Number using C++

stoi function

#include <iostream>

int main()
{
    std::string octalString = "50";
    int decimalNumber = stoi(octalString, nullptr, 8);

    std::cout << decimalNumber << std::endl;

    return 0;
}

Leave a Comment

Cancel reply

Your email address will not be published.