Skip to content

Instantly share code, notes, and snippets.

@Kyu
Created October 2, 2020 01:25
Show Gist options
  • Save Kyu/90a0929ac7f23f30dec668e9079ab220 to your computer and use it in GitHub Desktop.
Save Kyu/90a0929ac7f23f30dec668e9079ab220 to your computer and use it in GitHub Desktop.
#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