Use long as function parameter and return type : long « Data Types « C++ Tutorial






#include <iostream.h>

long Exp(long x,long n);
main()
{
   long   a,b,c;
   cout << "Enter 2 integers:";
   cin >> a >> b ;
   c = Exp(a,b);
   cout << "\nResult is:" << c << endl;
   return 0;
}

long Exp(long x,long n)
{
       long res=1;
       for (int i=1;i<=n;i++)
          res = res*x;
       return res;
}
Enter 2 integers:1 2

Result is:1








2.12.long
2.12.1.pointer to long value
2.12.2.Use long as function parameter and return type
2.12.3.Cast int to long
2.12.4.Output pointer value using cout