This program is not working

Naman, the approach you are using in your code is not correct, For prime seive, apply this logic only, I dnt know why are u applying INT MAX in your logic, Use this approach only as explained in the seive of erathosenes lecture of the online course,
p[0]=p[1]=0;
for(long long int i=3;i<=N;i=i+2)
{
p[i]=1;
}
for(long long int i=3;i<=N;i=i+2)
{
if(p[i])
{
for(long long int j=ii;j<=N;j=j+2i)
{
p[j]=0;
}
}
}

And store these values into some new array, and then use it in your main function…

What will be the value of n in this case i used int_max to find all the prime nos between 2 and into max then store all the nos and cout the nth primeno we want

You can use as, long long int N=1000000;
long long int p[N];
primeseive(p,N);
Primeseive will be the function, where you will have primeseive built as per the logic I have explained before…