/* main() function calls automatically, it calls when program is executed

,there are lot of functions which are already created, so we don't have to 
create them again.

for any function we have arguments.

example: Pow(arg1,arg2);

 ex. int multiply(int x, int y)
 {
	return x*y;
 }

 the above piece is called as function definition.It is written before we 
 call/execute the function. 

 multiply(2,3); is called function calling.

 we can just declare the function without defining it. ex. int multiply(int x, int y);

We can also call functions of different/other code by including the header file
in start of code by #include<headerfile> which will be discussed later. 

Let us write a sample program of pow() function imported from cmath library.



#include<iostream>
#include<cmath>
using std::cout;
using std::cin;

int main()
{	
	double base,power;
	cout<<"what is base \n";
	cin>>base;
	cout<<"enter the power \n";
	cin>>power;
	double result=pow(base,power);
	cout<<result<<std::endl;
}


//let us create a function by hand


#include<iostream>
using std::cout;
using std::cin;

double power(double base, int exponent)
{
	double result=1;
	for (int i=0;i<exponent;i++)
	{
		result*=base;
	}
	return result;
}

int main()
{	
	double base,exponent;
	cout<<"what is base \n";
	cin>>base;
	cout<<"enter the power \n";
	cin>>exponent;
	double result=power(base,exponent);
	cout<<result<<std::endl;
}

*/

//Let us create void function. void function does not return values.

#include<iostream>
using std::cout;
using std::cin;

double power(double base, int exponent)
{
	double result=1;
	for (int i=0;i<exponent;i++)
	{
		result*=base;
	}
	return result;
}

void print_pow()
{
	double base,exponent;
	cout<<"enter the base to find exponential\n";
	cin>>base;
	cout<<"enter the power \n";
	cin>>exponent;
	double result=power(base,exponent);
	cout<<result<<std::endl;
}
int main()
{	
	print_pow();
	print_pow();
}