In this article I would like to share with you a sample program that will ask the user to give a base and exponent and then our program will compute the power of the number using C++.
programming projects , thesis and capstone projects, IT consulting
work, computer tutorials and web development work kindly contact me in the following email address for further details. If you want to advertise in my website kindly contact me also in my email address also. Thank you.
I am currently accepting programming work, it project, school
programming projects , thesis and capstone projects, IT consulting
work, computer tutorials and web development work kindly contact me in the following email address for further details. If you want to advertise in my website kindly contact me also in my email address also. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
My personal website is http://www.jakerpomperada.com
My personal website is http://www.jakerpomperada.com
Program Listing
// power.cpp
// Author : Mr. Jake R. Pomperada, BSCS, MAED-IT
// Date : August 15, 2018 Wednesday
// Location : Bacolod City, Negros Occidental
// Website : http://www.jakerpomperada.com
// Email : jakerpomperada@jakerpomperada.com
#include <iostream>
#include <iomanip>
#include <math.h> // Used for pow() function
using namespace std;
int main()
{
double base=0.00, expo=0.00, power=0.00;
cout << "\n\n";
cout << "\tFind the Power of a Number";
cout << "\n\n";
cout << "\tEnter base: ";
cin >>base;
cout <<"\n";
cout <<"\tEnter exponent: ";
cin >> expo;
/* Calculates base^expo */
power = pow(base, expo);
cout << setprecision(2) << fixed;
cout << "\n\n";
cout <<"\tTHE RESULT";
cout <<"\n\n";
cout << "\t"<<base << " ^ " <<expo <<" = " << power;
cout << "\n\n";
return 0;
}
No comments:
Post a Comment