how to write something in power of a number in c++

Writing Power of a Number in C++

#include <iostream>
#include <cmath>

int main() {
    double base, exponent, result;

    std::cout << "Enter the base: ";
    std::cin >> base;

    std::cout << "Enter the exponent: ";
    std::cin >> exponent;

    result = pow(base, exponent);

    std::cout << base << " raised to the power of " << exponent << " is: " << result;

    return 0;
}

In this C++ program: 1. We include the necessary header files for input/output operations and mathematical functions. 2. We declare variables for the base, exponent, and result. 3. We prompt the user to enter the base and exponent. 4. We calculate the result using the pow function from the <cmath> library. 5. We display the result to the user.