Hey -
I wrote a program that works perfectly fine. It tests numbers to see if they are prime, specifically Proth numbers N=(k*(2^n)-1). It takes as input "k" and two values of "n" (upper + lower bounds) and tests all Ns in that range. Simple enough.
Problem is overflows. I eventually need to use arrays, I know.
For the time being, I want to re-write the program as it is to call a 64-bit power function as I have redefined all variables as __int64 instead of int.
Using arrays I should be able to mitigate overflows, but I haven't gotten there yet. The compiler doesn't like my function and I don't understand why. I spent a few hours at it but now I'm stumped.
Here's the cpp:
1 2 3 4 5 6 7 8 9 10 11 12
|
#include "stdafx.h"
using namespace std;
extern "C++" (__int64 power(__int64 X,__int64 Y) );
void multi(__int64 ,__int64 );
void check (__int64 );
int main()
All the rest of the code...
|
And, because it's relevant, here's the stdafx.h :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <cmath>
#include <fstream>
using namespace std;
__int64 power(__int64 ,__int64);
|
I get " error C2062: type '__int64' unexpected "
But I thought I defined it and all that. Why didn't it expect what I told it to expect in the header?
Thanks in advance for any insight.