I have written a simple tail recursive modular exponentiation function like this :
#include <bits/stdc++.h>
using namespace std;
#define mod (1000000000+7)
#define ll long long
ll modexp(ll x,ll n,ll res=1){
if(n==0) return res;
return modexp(x, n-1,(x % mod *res % mod) % mod);
}
int main(){
cout<<modexp(2,100000);
}
It is not running in my pc. I've tried in sublime with FastOlympicCoding which doesn't print anything. Then I tried using terminal :
PS C:\Users\User\Desktop\cpcpp> g++ test.cpp -o test.exe
PS C:\Users\User\Desktop\cpcpp> .\test.exe
PS C:\Users\User\Desktop\cpcpp>
This time it compiles but prints nothing. Then I tried in online ides like ideone, codechef. There it compiles and runs, for example: Ideone.
Then what is the problem in my native device?
I'm using Windows 10, GCC 12 with posix ...