-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathakpowerdriver.cpp
More file actions
31 lines (24 loc) · 907 Bytes
/
akpowerdriver.cpp
File metadata and controls
31 lines (24 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//======= >> raising a number to an integer power >> ===================================
//returns the greatest common denominator of two positive integers
//Arguments:
// x - number which will be raised to a power
// p - exponent or power to which the number x is raised
// =========================================================
#include <iostream>
#include <stdlib.h>
#include <cassert>
using namespace std;
//Declaration of function so it can appear in the main body of code before it is defined
double akpower(double x, int p);
//main body of code
int main()
{
cout<< "Input the number which is to be raised to a power:> ";
double x;
cin>> x;
cout<<"Input the integer power,pos or neg, to which the first number is to be raised:> ";
int p;
cin>> p;
cout<< " The number " << x << " raised to the power " << p << " is " << akpower(x, p) << endl;
return 0;
}