Page 1 of 1

long long int AND __int64

Posted: Mon Nov 01, 2004 6:08 pm
by muvee
I am running VC++ 6.0

Is there any way I can get the 'long long int' to work in it? Currently I am using __int64 and that is working fine.

However when I change my __int64 into 'long long int' and make the relative scanf and printf changes as well, I am forced to submit my solution without testing because VC++ on my computer does not support long long int.

Allternatively is there a way to make the Online Judge work with __int64?

So basically there are 2 questions:

1) How to use the 'long long int' in VC++ 6.0 in this form i.e. without resorting to__int64
2) How to make the online judge to accept my code if I have used __int64
in it.

Thanks.

Posted: Tue Nov 02, 2004 12:33 am
by Dominik Michniewski
use something like this

#ifdef ONLINE_JUDGE
#define LONG long long int
#else
#define LONG __int64
#endif

and after this use only LONG datatype ;-)

Best regards
DM

Posted: Tue Nov 02, 2004 12:37 am
by muvee
But the problem is that for __int64, I would need to use printf("%I64D",num)
where as for long long it would be different. BTW, what is the exact format for printing long long ints using printf?

Posted: Tue Nov 02, 2004 12:46 am
by Krzysztof Duleba
[cpp]printf("%lld", long_long_variable);[/cpp]

Posted: Wed Nov 10, 2004 5:04 pm
by Maniac
muvee, I have exactly the same problem. Let me know when you have a structural solution!

What I currently do is use a define statement for LONG (like Dominik Michniewski does) and then just before I send in to the judge, I change the printf statements by hand and send in the program without recompiling (while hoping I've made no typos) :-)