Created
October 2, 2020 01:25
-
-
Save Kyu/90a0929ac7f23f30dec668e9079ab220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int power(int a, int b) { | |
int pow = 1; | |
if (b == 0) { | |
return pow; | |
} | |
pow = a; | |
for (int i=1; i<b; i++) { | |
pow *= a; | |
} | |
return pow; | |
} | |
float power(double a, int b) { | |
float pow = 1; | |
if (b == 0) { | |
return pow; | |
} | |
pow = a; | |
for (int i=1; i<b; i++) { | |
pow *= a; | |
} | |
return pow; | |
} | |
int main() { | |
cout << power(10, 3) << endl; | |
cout << power(3.14159, 19); | |
int arr[5]; | |
arr[2] = arr[2] + 4; | |
cout << endl << "aa" << arr[5]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment