long long int AND __int64

Write here if you have problems with your C source code

Moderator: Board moderators

Post Reply
muvee
New poster
Posts: 25
Joined: Sun Sep 05, 2004 12:41 am

long long int AND __int64

Post by muvee » Mon Nov 01, 2004 6:08 pm

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.

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Tue Nov 02, 2004 12:33 am

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
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

muvee
New poster
Posts: 25
Joined: Sun Sep 05, 2004 12:41 am

Post by muvee » Tue Nov 02, 2004 12:37 am

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?

User avatar
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba » Tue Nov 02, 2004 12:46 am

[cpp]printf("%lld", long_long_variable);[/cpp]

Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac » Wed Nov 10, 2004 5:04 pm

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) :-)

Post Reply

Return to “C”