Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Degree(int* x, int degree) {
- if (degree == 0) {
- *x = 1;
- return;
- }
- int a = *x;
- for (int i = 0; i < degree - 1; i++) {
- *x *= a;
- }
- }
- int main() {
- int x = 5;
- Degree(&x, 3);
- cout << x << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment