~cpp
#include <iostream>
#include <stdlib.h>
using namespace std;

int power(int a, int b);

int main(int argc, char *argv[])
{
	int result1,result2;

	result1 = atoi(argv[1]);
	result2 = atoi(argv[2]);

	power(result1, result2);
//	cout << power(result1, result2);

	return 0;
}

int power(int a, int b)
{
	for(int i=0; i<b ; i++)
	{
		a*=a;
	}
	return a;
}

/*
int main()
{
	int result;
	char a[]="12213131";

	result = atoi(a);

	printf("%d\n", result);

	return 0;
}
*/
Retrieved from http://wiki.zeropage.org/wiki.php/제곱연산자 전달인자로 (Setting)
last modified 2021-02-07 05:31:04