Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double potega ( double x, int d )
- {
- if ( d == 0 )
- return 1;
- double wynik = 1;
- int i = 0;
- if ( d > 0)
- {
- do
- {
- wynik *= x ;
- i ++;
- }
- while (i < d);
- return wynik;
- }
- d = -d;
- do
- {
- wynik /= x;
- i ++;
- }
- while (i < d);
- return wynik;
- }
- int main()
- {
- cout << potega (1.5, -3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement