Martin Steen wrote:
> Tim S Roberts wrote:
>> If I have a value, say 13849, I can assign it to x and test if it
>> divisible by 37 by something like
>> if (x%37==0)...
>> and I can test if it's a square by something like
>> int y;
>> y=sqrt(x);
>> if (x==y*y)...
>>
>> But my question is, how can I do these two things (preferably as
>> simply and efficiently as possible) if my value is not 13849, but,
>> say, 176457628349?
>>
>> Tim
>>
>
> Some compilers (e.g. g++) support the __int64 datatype.
>
> __int64 BigIntVar = (__int64) 176457628349LL;
> cout << (BigIntVar % 37) << endl;
>
> - Martin
>
You sure about g++ supporting __int64?
[ccox-macbook:~] ccox% cat test.cpp
#include <iostream>
using namespace std;
int main()
{
__int64 BigIntVar = (__int64) 176457628349LL;
cout << (BigIntVar % 37) << endl;
return 0;
}
[ccox-macbook:~] ccox% g++ test.cpp
test.cpp: In function ‘int main()’:
test.cpp:6: error: ‘__int64’ was not declared in this scope
test.cpp:6: error: expected `;' before ‘BigIntVar’
test.cpp:7: error: ‘BigIntVar’ was not declared in this scope
--
Clark S. Cox III