By the power of

This code will take two numeric values you enter and will then find the power of so if you enter 5 then 7 you will get the answer to 5 by the power of 7, Spoiler Alert its: 78125, lol.

#include <iostream>
#include <cmath>
#include <string>

int main() {
    double base, exponent;
    std::string input1 = "What is the first value? ";
    std::string input2 = "What is the second value? ";
   
    std::cout << input1;
    std::cin >> base;
    if (base<=1) {
        std::cout << "A bigger number next time please!\n";
    }
    std::cout << input2;
    std::cin >> exponent;
    double power = pow(base, exponent);
    
    for (int c=0; c<10; c++) {
        std::cout << power << "\n";
    }
}

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *